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 General Discussion » CExtBarLabelButton sample code? Collapse All
Subject Author Date
Soo Wei Tan Dec 18, 2006 - 3:31 PM

I’m looking to make a label next to some combo boxes which are placed in a CExtToolControlBar. I found an old thread with some sample code ( but the method used there does not work for me for some reason. Therefore, I’ve decided to just hard code a label next to each combo box (no big deal).

Do you have any sample code which uses CExtBarLabelButton to insert a label into a toolbar?


Technical Support Dec 19, 2006 - 9:58 AM

You can insert a CExtBarLabelButton toolbar button into a CExtToolControlBar control as a custom toolbar button using the CExtToolControlBar::InsertSpecButton() method:

CExtToolControlBar * pWndToolBar = ...
LPCTSTR strCommandProfileName = g_CmdManager->ProfileNameFromWnd( pWndToolBar );
CExtCmdItem * pCmdItem = g_CmdManager->CmdAllocPtr( strCommandProfileName, 0 );
pCmdItem->m_sToolbarText = _T("Text to display on label button");
INT nLabelButtonIndex = ...
CExtBarLabelButton * pTBB = new CExtBarLabelButton( pWndToolBar, pCmdItem->m_nCmdID );
pWndToolBar->InsertSpecButton( nLabelButtonIndex, pTBB );

Soo Wei Tan Dec 18, 2006 - 3:53 PM

Also, is the implementation similar for CExtBarCheckBoxButton?

Technical Support Dec 19, 2006 - 10:00 AM

Use the same approach as described above.