|
-
May 6th, 1999, 10:27 PM
#1
Checking/Unchecking Menu Items
I need to allow a user to toggle a menu item.. checked on/unchecked off.
How do you code this? Can you provide an example?
Thank you for your assistance.
- Adrian
Adrian Mongeli
[email protected]
-
May 6th, 1999, 11:49 PM
#2
Re: Checking/Unchecking Menu Items
Hi,
You'll have to handle the UPDATE_COMMAND_UI handler for each of the menu items you want to check or uncheck. Now have a BOOL variable which toggles everytime the user clicks on the menu item in the COMMAND handler of the same menu item. In the UPDATE... handler just use
pCmdUI->SetCheck(YourBool);
An example
I'll declare a variable bCheck as BOOL
In the constructor I'll assign bCheck = FALSE;
CMyClass::OnXXX()
{
bCheck^=1; // This toggles the state;
//do your menu related operations
}
CMyClass::OnUpdateXXX(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(bCheck);
}
I hope this will help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|