|
|
|
|
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.
Subject |
Author |
Date |
|
Olaf Reusch
|
Jan 11, 2006 - 12:35 PM
|
I have some toolbars with comboboxes, but the controls are disabled and not changable.
See here a picture http://web.hlsw.org/other/combobox.jpg
What is wrong?
if(!m_wndServerListBar.Create(_T( "Resizable bar name" ), this, IDR_SERVERLIST )|| !m_wndServerListBar.LoadToolBar(IDR_SERVERLIST) ) { TRACE0("Failed to create ServerListBar\n"); return -1; }
if( !m_ServerListComboBox.Create( WS_CHILD | WS_VISIBLE |CBS_HASSTRINGS | CBS_DROPDOWN, CRect( 0, 0, 400, 480 ), &m_wndServerListBar, ID_SERVERLIST_COMBO ) || !m_wndServerListBar.SetButtonCtrl( m_wndServerListBar.CommandToIndex( m_ServerListComboBox.GetDlgCtrlID() ), &m_ServerListComboBox ) ) { TRACE0("Failed to create help search combobox\n" ); return -1; }
m_wndServerListBar.EnableDocking(CBRS_ALIGN_ANY);
if( !CExtControlBar::FrameEnableDocking(this) ) { ASSERT( FALSE ); return -1; }
DockControlBar(&m_wndServerListBar);
RecalcLayout();
|
|
Technical Support
|
Jan 12, 2006 - 2:55 AM
|
The CExtToolControlBar window manages a set of its buttons using MFC’s command update mechanism. The enabled/disabled state of a command button (which looks and acts like an ordinary push button) in a toolbar, is updated absolutely like the enabled/disabled state of the toolbar button with a combo box window attached. So, if you create a combo box window in a toolbar and attach it to the button specified by the ID_SERVERLIST_COMBO command identifier, then the enabled/disabled state of this button is updated absolutely like if this button were an ordinary push button in the toolbar. This button is enabled if the command handler for ID_SERVERLIST_COMBO is available in the main frame window or the command updating handler is added and it enables the command by invoking the pCmdUI->Enable() code. So, simply add the command handler method for the ID_SERVERLIST_COMBO command and leave this method body empty.
|
|