Home > Software engineering >  VC/MFC how to automatically update the user interface objects
VC/MFC how to automatically update the user interface objects

Time:10-08

Tong is a menu item toolbar button state of patients with a menu item above with the grey (effect), or cancel to choose a menu item with its disabled toolbar button;
Otherwise choose program logic conditions change who update some item status menu items by a like (than) document processing command can make sensible document update menu item documents contain update command is based on information with the user interface like menu toolbar button (perhaps) both transmit with the processing function encapsulation place by equivalent user interface code framework to provide updates as the user interface to update the user interface as a convenient interface to you to choose the type updated framework provides interface with high efficiency and easy to use column subject to explain why use update handler:
Call update ON_UPDATE_COMMAND_UI handler machine macro CCmdUI class use cases:
//file MainFrm. H add: # include "afxwin. H" OnUpdateAudioState//function name is the custom to pay attention to and face message map to afx_msg void OnUpdateAudioState (CCmdUI * pCmdUI);//the source file ManiFrm. CPP added://add position BEGIN_MESSAGE_MAP and END_MESSAGE_MAP () : BEGIN_MESSAGE_MAP (CMainFrame, CCaptionBarMainFrame)//parameters from the previous function name to: OnUpdateAudioState ON_UPDATE_COMMAND_UI (IDC_TOOL_AUDIO OnUpdateAudioState) END_MESSAGE_MAP ManiFrm () the same file. The CPP implementation function void CMainFrame: : OnUpdateAudioState (CCmdUI * pCmdUI) {if (ToolAvailable ())
} the handler calls to Enable access to menu items like the Enable member function to make a menu item

CodePudding user response:

  • Related