PRB: Problems with CMDIFrameWnd Toolbar Combo BoxLast reviewed: July 22, 1997Article ID: Q117685 |
1.00 1.50
WINDOWS
kbprg kbprb
The information in this article applies to:
SYMPTOMSUsing AppWizard, create an MDI application that contains a toolbar. Add a combo-box control to the toolbar using the same method that the CTRLBARS sample uses (see CMainFrame::CreateStyleBar() to create a combo box on the toolbar). When you drop the list-box portion of the combo box down and move the parent-frame window, the list box detaches from the edit-box portion of the combo box. With the CTRLBARS sample, the list box closes as soon as you click the frame window.
CAUSEThis behavior is ultimately caused by a problem in the combo-box control in Windows. For additional information, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q76365 TITLE : PRB: Moving or Resizing the Parent of an Open Combo BoxIn an SDI application, CFrameWnd::PreTranslateMessage() has code to detect when a CComboBox is the last active window. When this is true, the function sends a message to the CComboBox to close the drop-down list box. In an MDI application, CMDIFrameWnd::PreTranslateMessage() does not have any code to detect this special case; therefore, the combo box behaves as it normally does under Windows.
RESOLUTIONTo work around this problem, you should handle WM_PAINT messages in your MDI application for the parent-frame window of the combo box and send the combo box a message directly. For example, if your frame window is class CMainFrame, if your toolbar is called MyToolBar, and if MyToolBar has a combo box named MyCombo, your OnPaint() would look like this:
CMainFrame::OnPaint() { ... MyToolBar.MyCombo.SendMessage(CB_SHOWDROPDOWN, FALSE); ... } |
Additional reference words: 1.00 1.50 2.00 2.50
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |