Ticks in menus
-
When I created my SDI aplication it gives you the choice of having a status bar, if you select yes to this, when your program is created it creates a View menu with a status bar option inside. When you click on this option, a tick appears next to this if the status bar is shown and disappears if not. I wish to copy this functionality with another menu item but cannot work out how it does this in my program, any ideas? Thanks in advance for any help, Nick
-
When I created my SDI aplication it gives you the choice of having a status bar, if you select yes to this, when your program is created it creates a View menu with a status bar option inside. When you click on this option, a tick appears next to this if the status bar is shown and disappears if not. I wish to copy this functionality with another menu item but cannot work out how it does this in my program, any ideas? Thanks in advance for any help, Nick
On your OnUpdate handler use pCmdUI->SetCheck(m_bCondition);
-
When I created my SDI aplication it gives you the choice of having a status bar, if you select yes to this, when your program is created it creates a View menu with a status bar option inside. When you click on this option, a tick appears next to this if the status bar is shown and disappears if not. I wish to copy this functionality with another menu item but cannot work out how it does this in my program, any ideas? Thanks in advance for any help, Nick
In ClassWizard, select the command ID. Then, from the list on the right side, select UPDATE_COMMAND_UI. Create the handler. Inside the handler, call pCmdUI->SetCheck with TRUE or FALSE. BTW: you should have a look on any MFC tutorial, like Scribble. Tomasz Sowinski -- http://www.shooltz.com
-
In ClassWizard, select the command ID. Then, from the list on the right side, select UPDATE_COMMAND_UI. Create the handler. Inside the handler, call pCmdUI->SetCheck with TRUE or FALSE. BTW: you should have a look on any MFC tutorial, like Scribble. Tomasz Sowinski -- http://www.shooltz.com
thanks, that worked and I have been able to open and close this dialog from the view menu with the tick being displayed/hidden but how do I get the tick in the menu to disappear when the dialog is closed using the close button on the top-right of the screen. I can handle it using OnClose() in the dialog's class but how do I link it to the menu. thanks for your help so far, Nick
-
thanks, that worked and I have been able to open and close this dialog from the view menu with the tick being displayed/hidden but how do I get the tick in the menu to disappear when the dialog is closed using the close button on the top-right of the screen. I can handle it using OnClose() in the dialog's class but how do I link it to the menu. thanks for your help so far, Nick
ON_UPDATE_CMD_UI handler is called whenever user opens the menu. You have to check the state of the program and pass correct value to CCmdUI::SetCheck. Tomasz Sowinski -- http://www.shooltz.com