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 » Text button in embedded control bar. Collapse All
Subject Author Date
Finn Arildsen May 22, 2006 - 3:48 PM

I have a CExtToolControlBar embedded as a control in a dialog.

I want to add a button with a text (just like the UI Theme selectors in the FunnyBars example). The associated command does NOT exist in a menu anywhere, so cannot rely on getting any info from the cmdmgr, and therefore InsertButton does not work.

Could you provide a simple example on how to do this?

Thanks in advance

Technical Support May 24, 2006 - 1:10 PM

First of all, you need to allocate a new command in the command manager before using it in the toolbar button:

UINT nCmdID = 10000; // if zero, then free ID will be found automatically

CExtCmdItem * pCmdItem =

       g_CmdManager->CmdAllocPtr

              "your command profile name",

              nCmdID

              );
Now you have a valid registered command which has no icon nor text for menu/toolbar/tooltip/status tip assigned. We will assign only text for a toolbar here:
pCmdItem->m_sToolbarText = _T("text");
You can also assign tooltip:
pCmdItem->m_sTipTool = _T("tip text");
Now you can insert the button into a toolbar:
m_wndToolBar.InsertButton(

              nPos, // if -1, then append to end

              nCmdID

              )