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 » Dynamically Change the icon in CExtDynamicControlBar Collapse All
Subject Author Date
Chun Pong Lau Oct 3, 2006 - 1:16 AM

Dear support team,

How can I change the icon in CExtDynamicControlBar dynamically after its initialization by CExtDynamicBarSite::BarAlloc? I tried SetIcon but failed.

Thanks in advance,
Alan

Chun Pong Lau Oct 3, 2006 - 7:00 AM

Thanks for your response but after I added the code, I still cannot change the icon (please note that I am using dynamic control bar under tab document mode, CExtDynamicControlBar::__EDBS_DOCUMENT, the icon to be changed is on top of the document, inside the clickable tab).

I’ve also tried to use some method like GetParentFrame()->RecalcLayout(), Invalidate(), UpdateWindow() but it still doesn’t work.

Thanks in advance again.
Alan

Technical Support Oct 4, 2006 - 8:31 AM

We are sorry for the inconvenience. Please replace

LONG nItemCount = _BT::ItemGetCount();
with
LONG nItemCount = CExtTWPC < CExtTabWnd > :: ItemGetCount();

Technical Support Oct 3, 2006 - 2:40 AM

All the control bars use icons stored in the command manager:

CExtControlBar * pBar = . . . // or CExtDynamicControlBar
UINT nCmdID = UINT( pBar->GetDlgCtrlID() );
LPCTSTR strCmdProfileName = g_CmdManager->ProfileNameFromWnd( pBar->m_hWnd );
g_CmdManager->CmdSetIcon( strCmdProfileName, nCmdID, . . . );

Chun Pong Lau Oct 3, 2006 - 7:18 AM

After I added the code, I still cannot change the icon (please note that I am using dynamic control bar under tab document mode, CExtDynamicControlBar::__EDBS_DOCUMENT, the icon to be changed is on top of the document, inside the clickable tab).

I’ve also tried to use some method like GetParentFrame()->RecalcLayout(), Invalidate(), UpdateWindow() but it still doesn’t work.

Best regards,
Alan

Technical Support Oct 4, 2006 - 9:20 AM

We modified the SDI_DynamicBars to demonstrate how to change the bar icons on-the-fly. You can download it from our website.
The menu bar in this sample application contains two command items at the top level: SetIcon1 and SetIcon2. These commands allow you to change the icons of all the dynamic bars. These commands are handled in the CMainFrame::OnSetIcon1() and CMainFrame::OnSetIcon2() methods. These simple methods invoke the CMainFrame::_SetIconToAllDynamicBars() method which replaces icons of all the dynamic control bars with the specified icon. The CMainFrame::_SetIconToOneDynamicBar() method is used to change the icon of one particular dynamic control bar.

Chun Pong Lau Oct 5, 2006 - 1:34 AM

Thank you. It works perfectly!

Alan