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 |
|
Alastair Watts
|
Aug 19, 2010 - 9:52 AM
|
I’m currently using the following code to update the UI state. How can I do this outside of ::OnCmdMsg()
BOOL CPlantingLibrariesDlg::OnCmdMsg(UINT nID, INT nCode,
void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) // update UI
{
{
case ID_LIBRARY_DELETE:
pCmdUI->Enable(m_wndLibraryList.SelectionIsEmpty() ? FALSE : TRUE);
} break;} if(nCode == CN_UPDATE_COMMAND_UI)switch(nID) { CCmdUI * pCmdUI = (CCmdUI*)pExtra;
|
|
Technical Support
|
Aug 20, 2010 - 11:50 AM
|
Here is how to make your toolbar to perform the command updating requests for all the buttons through its parent dialog window:
CExtToolControlBar * pToolBar = . . .
CExtResizableDialog * pDialog = . . .
pToolBar->OnUpdateCmdUI( (CFrameWnd*) pDialog, TRUE );
|
|
Alastair Watts
|
Aug 20, 2010 - 4:07 AM
|
I’m handling MFC command updating though CExtResizableDialog::OnCmdMsg(). Having deleted all items from a list I need to update the toolbar to disable a button. How do I force OnCmdMsg() to update?
|
|
Technical Support
|
Aug 19, 2010 - 12:18 PM
|
We suspect the code snippet was pasted incorrectly. There are only two ways to handle MFC command and command updating queries: 1) Override the CCmdTarget::OnCmdMsg() virtual method. 2) Use the ON_COMMAND , ON_COMMAND_EX and ON_UPDATE_COMMAND_UI message map entries. We suspect you should route OnCmdMsg() virtual method invocations from the CPlantingLibrariesDlg class to other classes where you need to handle particular commands.
|
|