PRB: Problems with CMDIFrameWnd Toolbar Combo BoxID: Q117685
|
Using 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.
This 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:
Q76365 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.
To 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 query words: 1.00 1.50 2.00 2.50
Keywords : kb16bitonly
Version :
Platform :
Issue type :
Last Reviewed: July 26, 1999