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 » Toolbar - setting gap between 2 comboboxes Collapse All
Subject Author Date
Suhai Gyorgy Oct 2, 2007 - 9:43 AM

Dear Support,

In one of our toolbars we need to display 2 comboboxes right next to each other. This works fine but I can’t figure out how to leave some gap between the 2 comboboxes. Adding a separator doesn’t look good.

I’ve read something about CToolBar::SetButtonInfo, that it can set the width of a button which has a TBBS_SEPARATOR style, but CExtToolControlBar::SetButtonInfo is missing one parameter compared to CToolBar::SetButtonInfo, so I can’t use that here.

Could you please advise?
Thank you!

Technical Support Oct 2, 2007 - 12:37 PM

There are two ways. First, you can code your own CExtBarButton-derived class that implements the CExtBarButton::CalculateLayout() and CExtBarButton::_UpdateCtrl() methods. In the CExtBarButton::CalculateLayout(), you should invoke the parent class’s method and return a wider CSize object in order to reserve the needed space on the right side of the attached combo box. Leave CExtBarButton::_UpdateCtrl() similar to the original one, but reposition the attached combo box window to the location which is less wide than the button’s width. The first combo box button should use such a toolbar button class.

The second way is a bit simpler. Just use a disabled command button between the combo box buttons. This button should also be based on your own CExtBarButton-derived class that implements the CExtBarButton::CalculateLayout() method. This method should simply return CSize(3,1) with 3 being the number of pixels between combo boxes. Finally use CExtToolControlBar::InsertSpecButton() to use your custom button class for a particular toolbar button.

If you encounter any difficulties, please do not hesitate to contact us.

Suhai Gyorgy Oct 3, 2007 - 2:36 AM

I’ve implemented the second solution, it works great, thank you!