PRB: StatusBar Pane Enabled by DefaultLast reviewed: August 7, 1997Article ID: Q151901 |
4.00 4.10
WINDOWS NT
kbui kbprg kbprb
The information in this article applies to:
SYMPTOMSWhen a non-default pane is added to the StatusBar, this pane is automatically enabled even if it does not have an Update UI handler.
CAUSEThis behavior is different than the behavior in earlier versions of MFC where the pane was automatically disabled if there was no Update UI handler.
RESOLUTIONTo disable the pane, unless it is enabled by a handler, add an Update UI handler for the pane to the CMainFrame class of the application that disables the pane.
STATUSThis behavior is by design.
MORE INFORMATIONIn certain situations the pane can be disabled by default, such as when the pane is displaying the status associated with a Document or the View. In these situations, you should disable the pane if no Document/View is open. To disable the pane by default, add an Update UI handler for this pane to CMainFrame. Add an update UI handler in the Document or View that updates the pane depending on the status. When a Document/View is open, then the update UI handler in the Document/View will update the pane depending on its state. When all documents are closed, the Update handler in CMainFrame will disable the pane.
MORE INFORMATION
Sample Code
/* Compile options needed: default */ // Following code disables a pane in the StatusBar with ID, // ID_MYPANE in the CMainFrameClass. // MainFrm.h : interface of the CMainFrame class ... class CMainFrame : public CMDIFrameWnd { ... //}}AFX_MSG afx_msg void OnUpdateMypane(CCmdUI* pCmdUI); DECLARE_MESSAGE_MAP() }; // MainFrm.cpp : implementation of the CMainFrame class ... BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd) //{{AFX_MSG_MAP(CMainFrame) ... //}}AFX_MSG_MAP ON_UPDATE_COMMAND_UI(ID_MYPANE, OnUpdateMypane) END_MESSAGE_MAP() static UINT indicators[] = { ID_SEPARATOR, // status line indicator ID_MYPANE, //String resource with this ID in resources ID_INDICATOR_CAPS, ID_INDICATOR_NUM, ID_INDICATOR_SCRL, }; ... void CMainFrame::OnUpdateMypane(CCmdUI* pCmdUI) { pCmdUI->Enable(FALSE); } |
Additional reference words: 4.00 4.10 CStatusBar enable
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |