Solved

Menu CheckBox Bitmap

Posted on 2004-08-16
4
470 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks Nass!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now