Checking a menu item 
Author Message
 Checking a menu item

I have a menu item that needs to use the "check mark" toggle. I have added
an event handler for the menu item.
The menu's id is ID_MENU_ITEM. From the OnMenuItem() function how do I see
if it is already checked and check it if it is not?

Bob T



Tue, 02 Aug 2005 09:39:50 GMT  
 Checking a menu item
OnMenuItem()
{
static BOOL bChecked=FALSE;
bChecked=~bChecked;
... ...

Quote:
}



Quote:
> I have a menu item that needs to use the "check mark" toggle. I have added
> an event handler for the menu item.
> The menu's id is ID_MENU_ITEM. From the OnMenuItem() function how do I see
> if it is already checked and check it if it is not?

> Bob T



Tue, 02 Aug 2005 10:28:35 GMT  
 Checking a menu item
Let me rephrase the question. How do you toggle the checked property of an
menu item? I want to actually show the check mark on the menu.


Quote:
> OnMenuItem()
> {
> static BOOL bChecked=FALSE;
> bChecked=~bChecked;
> ... ...
> }



> > I have a menu item that needs to use the "check mark" toggle. I have
added
> > an event handler for the menu item.
> > The menu's id is ID_MENU_ITEM. From the OnMenuItem() function how do I
see
> > if it is already checked and check it if it is not?

> > Bob T



Tue, 02 Aug 2005 12:20:14 GMT  
 Checking a menu item

Quote:

> I have a menu item that needs to use the "check mark" toggle. I have added
> an event handler for the menu item.
> The menu's id is ID_MENU_ITEM. From the OnMenuItem() function how do I see
> if it is already checked and check it if it is not?

> Bob T

Add an event handler for the ON_UPDATE_COMMAND_UI message for the same
ID.  The BOOL value that you pass to SetCheck will control the check
mark.

void CMainFrame::OnUpdateColors(CCmdUI* pCmdUI)
{
   pCmdUI->SetCheck(m_bShowingColors);

Quote:
}

--
Scott McPhillips [VC++ MVP]


Tue, 02 Aug 2005 13:38:28 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. check\unchech menu items

2. Checked a Menu Item

3. check\uncheck menu items

4. How to check/uncheck menu items?

5. Dialog app - checking a menu item ??

6. How to check a menu item in a dialog based application

7. HELP?Checking a menu item?

8. menu - checking & unchecking a menu item

9. How to check/uncheck menu items in AppWiz generated SDI app?

10. How to check a menu item is enabled or grayed?

11. How to check a menu item is enabled or grayed?

12. Placing a Check Next to a Menu Item

 

 
Powered by phpBB® Forum Software