Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Width of combo drop-down from toolbar? Collapse All
Subject Author Date
Robert Webb Dec 1, 2010 - 11:38 PM

I have a combo box on a toolbar, defined by calling cmdItem->StateSetCombo() from LoadToolBar().  However I can’t figure out how to change the default width or max height of the drop-down popup.  I want to make the popup wider in order to fit the longest item it contains.


Setting cmdItem->m_nDropDownWidth and cmdItem->m_nDropDownHeightMax have no effect.


I also tried overriding OnPopupListBoxMeasureTrackSize() in the frame and returning different sizes, but again it makes no difference.  I have confirmed that it does indeed enter this function.


Should those things be working as I’d hoped?  Is there something else that might be overriding their directions?


Even better, is there a simple way to ask a combo box’s popup to auto-fit the longest item?


Thanks,


Rob.

Technical Support Dec 2, 2010 - 4:54 AM

Here is how combo fields are configured in the CMainFrame::OnCreate() method of the StyleEditor sample application:

    pCmdItem = g_CmdManager->CmdGetPtr( pApp->m_pszProfileName, ID_SE_STYLE_LIST );
    pCmdItem->StateSetCombo();
    pCmdItem->StateSetResizable();
    pCmdItem->m_nTextFieldWidth = /*pCmdItem->m_nDropDownWidth =*/ 120;
    pCmdItem->m_nDropDownWidth = -1; // auto-calc
    pCmdItem->m_nDropDownHeightMax = 500;
    //pCmdItem->StateSetTextFieldNotEditable();

    pCmdItem = g_CmdManager->CmdGetPtr( pApp->m_pszProfileName, ID_SE_FONT_LIST );
    pCmdItem->StateSetCombo();
    pCmdItem->StateSetResizable();
    pCmdItem->m_nTextFieldWidth = /*pCmdItem->m_nDropDownWidth =*/ 150;
    pCmdItem->m_nDropDownWidth = -1; // auto-calc
    pCmdItem->m_nDropDownHeightMax = 500;
    //pCmdItem->StateSetTextFieldNotEditable();

    pCmdItem = g_CmdManager->CmdGetPtr( pApp->m_pszProfileName, ID_SE_SIZE );
    pCmdItem->StateSetCombo();
    pCmdItem->StateSetResizable();
    pCmdItem->m_nTextFieldWidth = /*pCmdItem->m_nDropDownWidth =*/ 45;
    pCmdItem->m_nDropDownWidth = -2; // same as button width
    pCmdItem->m_nDropDownHeightMax = 500;
    //pCmdItem->StateSetTextFieldNotEditable();

Please note, the code above is invoked before CExtCustomizeSite initialization. You should also erase application state data in the registry to see the changes in combo fields.