|
|
|
|
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 |
|
Neville Franks
|
Oct 25, 2006 - 2:26 AM
|
Hi, I’ve been trying for hours to get a Combobox to display in a Toolbar, but all I see is the button image, not the combobox. Here is the code:
// .rc
ID_VIEW_UI_LOOK_BAR TOOLBAR MOVEABLE PURE 16, 16 BEGIN BUTTON ID_VIEW_LIKE_STUDIO_2005 BUTTON ID_VIEW_LIKE_OFFICE_2003 BUTTON ID_VIEW_LIKE_OFFICE_XP BUTTON ID_VIEW_LIKE_OFFICE_2K BUTTON ID_SearchComboUnicode END
// .h #define ID_SearchComboUnicode 20206
CExtComboBox m_wndComboSearch;
// .cpp if ( !m_wndToolBarUiLook.Create( NULL, this, ID_VIEW_UI_LOOK_BAR ) || !m_wndToolBarUiLook.LoadToolBar( ID_VIEW_UI_LOOK_BAR ) ) { TRACE( "Failed to create UI Look Toolbar\n" ); return -1; // fail to create }
if ( !m_wndComboSearch.Create( WS_CHILD|WS_VISIBLE|CBS_HASSTRINGS|CBS_DROPDOWN, CRect(0,0,140,200), &m_wndToolBarUiLook, ID_SearchComboUnicode ) ) { TRACE( "Failed to create m_wndComboSearch\n" ); ASSERT( FALSE ); return -1; // fail to create }
VERIFY( m_wndToolBarUiLook.SetButtonCtrl( m_wndToolBarUiLook.CommandToIndex( ID_SearchComboUnicode ), &m_wndComboSearch ) ); m_wndComboSearch.SetFont( CFont::FromHandle( (HFONT)::GetStockObject(DEFAULT_GUI_FONT) ) ); m_wndComboSearch.SetItemHeight( -1, m_wndComboSearch.GetItemHeight(-1) - 1 ); m_wndComboSearch.AddString( _T("Sample Car 1") );
I’ve looked over the ProfStudio sample code and can’t see any difference between that and what I’m doing.
Neville, http://www.surfulater.com
|
|
Neville Franks
|
Oct 25, 2006 - 2:45 PM
|
I would like to use a combobox and use the customization system.
Is there any way to tell the customization system to ignore a specific toolbar or ignore a specific command (ID) so I can use a combobox?
Also am I correct in assuming that we can’t use any of our own controls on a toolbar if it is customizable?
|
|
Technical Support
|
Oct 27, 2006 - 6:00 AM
|
You can disable customization of a particular toolbar by setting its CExtToolControlBar::m_bCustomizationAllowed property to false. If you want to do the same for a particular toolbar button, you should override two methods:
1) CExtCustomizeSite::OnCustomizeCmdTreeNode() , which disables the button’s context menu when the Customize dialog is open; 2) CExtCustomizeSite::DoDragCmdNode() , which suppresses drag-and-drop for this command item.
You can have any control in the toolbar by attaching this control to a toolbar button. For customizable applications, you should attach this control after the customize site has already been initialized in the frame window. But please note, such a control will never appear in menus (including toolbar’s chevron menu) nor it can be drag-and-dropped during customization (it handles mouse clicks in its own manner).
|
|
Neville Franks
|
Oct 25, 2006 - 5:58 AM
|
I also should have mentioned I tried adding the Combobox to two different toolbars with the same result.
|
|
Neville Franks
|
Oct 25, 2006 - 5:49 AM
|
Suhai, thanks but I don’t use CExtThemeSwitcherToolControlBar.
One difference between the ProfStudio sample and my app is that I use the Prof-UIS Customization Subsystem CExtCustomizeSite and I’m wondering if that stops you from using your own controls on Toolbars. If so that seems like a fairly major limitation.
|
|
Suhai Gyorgy
|
Oct 25, 2006 - 6:43 AM
|
I’ve just tried it. It works for me just fine and I’m not using Customization Subsystem. So it should be something else. I’m using ProfUIS v2.55, Static Unicode Debug and Studio2005 PaintManager with VS7.1, WinXP. I have no idea how this could help you, but I don’t have any more guesses now. But at least you can eliminate Customization as possible cause.
|
|
Technical Support
|
Oct 25, 2006 - 11:38 AM
|
There are two rules that can be applied to combo box windows in toolbars: 1) If you have a customizable toolbar, do not use a combo box window inside. Just use built-in combo fields instead. 2) If you have a non-customizable toolbar, you can attach a combo box window (created as a child of the toolbar window) to a toolbar button.
Such combo box(es) should cause any problems.
|
|
Suhai Gyorgy
|
Oct 25, 2006 - 3:30 AM
|
Just a guess: if your m_wndToolBarUiLook variable is that of CExtThemeSwitcherToolControlBar class then the initialization is different and that might prevent that particular toolbar to have any extra buttons or controls in it. Try making another toolbar and add the combobox in that one.
|
|