Professional UI Solutions
Site Map   /  Register


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 » Labelling CExtBarButton and CExtBarColorButton? Collapse All
Subject Author Date
Peter Meier Aug 10, 2009 - 6:55 AM


How is it possible to label a CExtBarButton or a CExtBarColorButton so that it would i.e diaplay "Pattern:" or "Color:" left of it?

Thanks - Peter

Technical Support Aug 10, 2009 - 7:42 AM

It’s possible to implement your CExtBarButton-derived and/or CExtBarButton-derived classes which implement custom measuring/painting. But it’s easier to insert the CExtBarLabelButton toolbar buttons before other buttons. You can insert any type of toolbar button into toolbar using the CExtToolControlBar::InsertSpecButton() method. But the preferred solution is the following:

1) Create and use your CExtToolControlBar-derived class.

2) Define additional buttons in toolbar resource for the label buttons. The icon image is not important and can display anything.

3) Implement the CExtToolControlBar::OnCreateBarCommandBtn() virtual method in CExtToolControlBar-derived class. Your method should instantiate the CExtBarLabelButton objects for label buttons and invoke the parent class method for other buttons.

This approach can be used for instantiating any non-push buttons in toolbar, including color picker buttons. Please note, the label buttons are displaying command’s toolbar text stored in the command manager. I.e. they display the same text as the CExtBarButton toolbar push/command buttons can display. You should invoke the following code to assign toolbar button text:

g_CmdManager->CmdGetPtr( . . . )->m_sToolbarText = _T("text in toolbar");