Solved

Menu CheckBox Bitmap

Posted on 2004-08-16
4
476 Views
Last Modified: 2013-11-20
Im currently using the following code to toggle between different modes of operation via the menu:

    CMenu* menu = AfxGetMainWnd()->GetMenu();
    CMenu* subMenu = menu->GetSubMenu(1);

    subMenu->CheckMenuRadioItem( ID_MODE_EDIT, ID_MODE_ZOOM, ID_MODE_EDIT, MF_BYCOMMAND | MF_CHECKED );

The default bitmap for this displays a bullet point bitmap, instead of the tick\check bitmap.
Any ideas on how to achieve this without the SetMenuBitmap function again.

The event handler function is written in the doc class
0
Comment
Question by:spiffles
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:Nass89
ID: 11817613
Hi,
Add OnUpdate menu item for the menu you wat to tick:

void ViewClass::OnUpdateMyMenu(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
if(condition==TRUE)
pCmdUI->SetCheck(1);
else
pCmdUI->SetCheck(0);

}

Good Luck!
0
 

Author Comment

by:spiffles
ID: 11817685
thanks but i need to be
able to switch between to menu items
i.e. one checked and one not checked.
how do i uncheck the other one?

Thats why i was using CheckMenuRadioItem(). cept it has the stupid
bullet point bitmap
0
 
LVL 5

Accepted Solution

by:
Nass89 earned 25 total points
ID: 11827519
Hi,
Add the same OnUpdate for another Menu item and while you check first one uncheck another.

void ViewClass::OnUpdateMyMenuItem1(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
if(condition==TRUE)
pCmdUI->SetCheck(1);
else
pCmdUI->SetCheck(0);

}

void ViewClass::OnUpdateMyMenuItem2(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
if(condition==TRUE)
pCmdUI->SetCheck(0);
else
pCmdUI->SetCheck(1);

}

Good Luck!
0
 

Author Comment

by:spiffles
ID: 11889251
Thanks Nass!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adapt this command to show who installed 29 112
Host to IP 7 83
How do you programatically show and hide the Windows 10 On-Screen-Keyboard? 3 924
Work with App store 7 94
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question