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 General Discussion » Unable to customize a toolbar Collapse All
Subject Author Date
Chris Thomas Jun 16, 2005 - 8:12 AM

Hello, I’ve got an app with customization enabled, and it is all working fine, except for one glitch. One of the toolbars cannot be customized. When the customize dialog is showing, you can normally click on toolbar buttons and see them selected with a thick black border, and can drag and drop them around. This app has about 7 toolbars. The problem is that one of the toolbars doesn’t let you click on any of its buttons - no selection, no black border.

All the toolbars are derived from your toolbar class, with this problem toolbar additionally derived from my derived class. This particular toolbar happens to have two combo boxes as buttons, and one button also has a dropdown menu attached to it. It has custom methods to create and host the combo boxes.

FYI all of the toolbars are using a custom CExtBarButton-derived class which has an enabled icon and a disabled icon (instead of simply graying out), and optional text drawn to the right of the icon. This works great. The class has its own CalculateLayout() and Paint() methods.

Also, what is the suggested technique for creating comboboxes on toolbar buttons? Right now they are created via a method on my toolbar class, but should I be using CExtCustomizeSite::OnCreateToolbarButton() instead?

Lastly, how can I prevent the user from customizing the menubar?

Thanks

Technical Support Jun 16, 2005 - 11:12 AM

Please make sure that the MFC base class is the first in the list of base classes when you are using the C++ multiple inheritance with MFC (and Prof-UIS) classes in your CExtToolControlBar-derived class. Additionally, please ensure you have not set the CExtToolControlBar::m_bCustomizationAllowed property to false for your problem toolbar. The custom toolbar buttons cannot affect this problem but toolbar buttons with windows inside (like combo boxes) can deal with it. You should not use windows inside toolbar buttons in the customize mode. Please use built-in edit and combo fields instead as it is demonstrated in the StyleEditor sample application. These fields are fully compatible with customizable applications and you can even create several copies of a particular field (in the Customize mode). The main feature of the built-in edit and combo fields is that the CExtCustomizeSite class automatically synchronizes their content, i.e. if you create a second copy of a field and change the value of one of them, then the second is updated automatically. This is done via a set of the OnTextField...() and OnPopupListBox...() virtual methods provided by the CExtCustomizeSite class. The StyleEditor sample demonstrates how to override and implement them. The built-in combo field is designed as a kind of built-in text field with a combo box like drop-down button displaying a pop-up list box. The built-in combo field is also described by the command item in the command manager. Please take a look how the font combo field is initialized in the CMainFrame::OnCreate() method of the StyleEditor sample:

 
    pCmdItem =
        g_CmdManager->CmdGetPtr(
            pApp->m_pszProfileName,
            ID_SE_FONT_LIST );
    pCmdItem->StateSetCombo();
    pCmdItem->StateSetResizable();
    pCmdItem->m_nTextFieldWidth =
        pCmdItem->m_nDropDownWidth = 150;

You can make your menu non-customizable by setting its CExtToolControlBar::m_bCustomizationAllowed property to false. Do not also call CExtCustomizeSite::MenuInfoAdd...() methods.



Chris Thomas Jun 16, 2005 - 1:01 PM

Thank you for the quick reply!