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 » Dockable Toolbar with combo box Collapse All
Subject Author Date
Nicholas Vezirgiannis May 19, 2009 - 5:22 AM

Hallo sir,


I’m using your Prof-UIS project for almost 2 years now and everything seems fine. Now the project needs have raised a question. Is it possible to somehow put a COMBOBOX in a TOOLBAR, instead of buttons? Combining combobox and buttons in a dockable toolbar would be ideal. Please respond with example code or detailed guidelines on how to do this with your interface.


Thanks for all your help in advance.


 

Nicholas Vezirgiannis May 25, 2009 - 10:03 AM

Thank you for your responce it was very helpful.


I have created the combo box in the toolbar and I have derived a class out of the CExtComboBox to catch the OnCBSetCurSel event. Unfortunatelly this event does not run when I am changing the selection of the combobox. Please tell me if I am using the wrong event or if I have an error in the derived class and how to correct it. My derivation code follows. Thanks in advance for all your help.

 


  CPageSelectionCombo : public CExtComboBox

public


:

CPageSelectionCombo();


~CPageSelectionCombo();


LRESULT CPageSelectionCombo::OnCBSetCurSel(WPARAM wParam, LPARAM lParam);


};



CPageSelectionCombo::CPageSelectionCombo()


{


}


CPageSelectionCombo::~CPageSelectionCombo()


{


}


LRESULT CPageSelectionCombo::OnCBSetCurSel(WPARAM wParam, LPARAM lParam)


{


 


 


}


int k=0;return CExtComboBox::OnCBSetCurSel(wParam, lParam);


class


{


Technical Support May 25, 2009 - 12:49 PM

Please add the following line to the message map of your CExtComboBox-derived class:

   ON_CONTROL_REFLECT( CBN_SELENDOK, OnSelEndOK )
Then please add the following method into the same class:
   afx_msg void OnSelEndOK();

void CYourComboBoxClassName::OnSelEndOK()
{
            ASSERT_VALID( this );
            Default();
            //
            // TO-DO: handle combo box selection changing here
            //
}

Technical Support May 20, 2009 - 10:01 AM

There are three different ways to put a combo box into a toolbar:

1) This approach is based on simple toolbars. Just create the CExtComboBox window as child of the CExtToolControlBar window and attach it to some toolbar button using the CExtToolControlBar::SetButtonCtrl() method. You can use the CExtToolControlBar::CommandToIndex() method to get the zero based button index by its command identifier. Indeed, you should create your own CExtComboBox-derived class because you will need to use the message reflection to handle the input events of this combo box. The combo box will be visible when the toolbar is docked horizontally or floating. The toolbar button will be visible in the vertically docked toolbar and in the chevron menu. So, the toolbar button should have an icon and you should handle this button as command. The combo box window is automatically disabled/enabled via MFC command updating mechanism. You can see such combo box controls inside toolbars on the Menubar & Toolbars dialog page in the ProfUIS_Controls sample application. The GLViews sample application uses the CExtComboBox-derived windows in toolbars for configuring view cameras and this is the ready to use code for you.

2) This approach is based on customizable toolbars and menus. The CExtCustomizeSite-based customization subsystem for toolbars and menus supports built-in text and combo fields in toolbars and menus. Please take a look at the StyleEditor sample application. You can see style, font name and font size combo boxes in toolbar and menus there. These combo boxes are not the HWND-based windows attached tool toolbar buttons like described in the first approach. These three combo boxes are built in combo fields supported by the Prof-UIS customization subsystem for toolbars and menus. Such combo fields can be seen in menus, including chevron menu of toolbar. You can drag-n-drop the combo fields with Alt key pressed and you can create cloned copies of them when dropping into new location in toolbars and menus with the Ctrl key pressed. The customization subsystem supports automatic synchronization of such combo field copies. To use such combo fields you should switch using customizable toolbars and menus first:

http://www.prof-uis.com/prof-uis/tech-support/feature-articles/prof-uis-customization-subsystem.aspx

3) This approach is similar to the second, but you can choose more advanced version of the customization subsystem for toolbars and menus. It’s called Prof-UIS Automation Pack or shortly ProfAuto. It’s demonstrated in the ActiveScripts and SimpleScripting sample application. ProfAuto is set of wrapper COM objects for customizable toolbars and menus. It’s discussed here:

http://www.prof-uis.com/prof-uis/tech-support/feature-articles/scripting-support-in-prof-uis-applications.aspx