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 » Add icon to the Control Bar caption Collapse All
Subject Author Date
Rajneesh May 8, 2003 - 5:20 AM

How do i add an icon (16x16) on the title bar of my dockable windows created from CExtControlBar. I want the icon to be displayed with the title of the control bar.

Customer Support Team May 13, 2003 - 1:13 PM

You can fake the icons in the title-bar by implementing your own non-client buttons. Each control bar may have several non-client area buttons (like "X" button of a floating bar). The buttons may be aligned to the left or to the right. They also may paint their own areas. In the MDI sample you can see the "Task-Panel" bar with 2 buttons ("<-" and "->") which are located at the right part of the caption. They are clickable. You should write your own no clickable button, which will paint an icon in its area.
All the buttons are instances of the classes derived from CExtBarNcAreaButton. Your button should be similar to the "<-" or "->" button in the MDI sample but the OnNcAreaDraw() method should paint an icon and OnNcAreaClicked() should do nothing. This button should return a false value in the OnQueryVisibility() method if the control bar is not in the floating state.
To insert your button into the caption of the control bar you need your own class derived from CExtControlBar (or CExtToolControlBar, or CExtMenuControlBar). Your control bar should override the OnNcAreaButtonsReinitialize() virtual method:

void CMyControlBar::OnNcAreaButtonsReinitialize()
{
CExtControlBar::OnNcAreaButtonsReinitialize()
INT nCountOfNcButtons = NcButtons_GetCount();
if( nCountOfNcButtons > 0 )
return;
NcButtons_Add( new CMyIconButton(this) );
}

As we mentioned before, CMyIconButton should be derived from CExtBarNcAreaButton.
Please find the CBarNcTaskAreaBtn class in the MainFrm.h file of the MDI sample and use it as a guide of writing custom non-client buttons.

Please note the vertical height of a floating mini-frame window is usually less than 16 pixels. You may need to paint icons with the height a little bit less than 16. These icons may be 16x16 or 32x32, but any meaningful image should be approximately 12x12. Otherwise your icon may not fit the caption height.

Please contact us if you have any difficulties.