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 » CExtControlBar and icon Collapse All
Subject Author Date
Thomas Maurer Oct 18, 2005 - 7:03 AM

Hello


I have a MDI child that has two auto-hideable control bars in one tab container. I want them to have an icon when they are auto-hidden and on the tab when they are open.


I saw this behaviour in the "ProfStudio" sample for "Running Documents" etc.. I tried to understand how the icon and the controlbar are connected and came to the conclusion that it must be the ID that is passed when calling the Create method. If the ID is connected to a command with a certain icon then this icon will be displayed.


I did the same in my code and created the controlbar accordingly. I don’t get an icon though although the ID is visible in the menu and the toolbar with the correct icon. What am I doing wrong? Is it important that the controlbar is a child of an MDI child and not of the mainframe?


Thanks in advance


Thomas M.

Technical Support Oct 18, 2005 - 8:46 AM

Yes, you are right, the icon should be associated with the ID (in the global command manager) that you pass in the Create() method. There are two methods with which you can assign the icon.

1) By using the g_CmdManager->CmdSetIcon method:

 CExtImageList ilBitmaps( IDB_BITMAPS, RGB(255,255,0), 4 );
 VERIFY( 
  g_CmdManager->CmdSetIcon( 
   g_CmdManager->ProfileNameFromWnd( GetSafeHwnd() ),
   IDC_RESIZABLE_BAR_1, 
   ilBitmaps.ExtractIcon(1),
   false
   )
  );
2) Create a temporary toolbar, insert buttons with the corresponding IDs and bitmaps into it, and then invoke the code like below:
 VERIFY(
  g_CmdManager->UpdateFromToolBar(
   g_CmdManager->ProfileNameFromWnd( GetSafeHwnd() ),
   IDR_TOOLBAR_WITH_BITMAPS
   )
  );
Both these methods can be used within the CMainFrame::OnCreate() method.