Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Menu Item

Posted on 2001-09-14
4
Medium Priority
?
264 Views
Last Modified: 2010-04-02
I was interested on interacting between a variable and menu item using the check mark in the menu item such as the one by the Status Bar Item under View menu item in the windows explorer.

I like to know if the item is checked or not via some variable.

Thanks
Matt
0
Comment
Question by:mrfard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 6484154
What type of project do you have?
What is the compiler?
What is the target OS?
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 400 total points
ID: 6484406
If you are writing in MFC, the easist way is to use the ON_UPDATE_COMMAND_UI handler.  When you want a checkmark to appear, use (eg)

void CMainFrame::OnUpdateViewStatusBar(CCmdUI* pCmdUI)
{
    pCmdUI->SetCheck( m_fShowStatusBar );
}

where m_fShowStatusBar is a member variable (BOOL) that reflects the show.hide state of the status bar.  

If you are programming in non-MFC for Windows, it is a bit more complicated because you need to get a handle to a submenu, but it boils down to using the CheckMenuItem() Win32 API fn.

If you are programming in Unix, u r on ur own.

-- Dan
0
 

Author Comment

by:mrfard
ID: 6490309
Sorry;

I am writing it in Visual C++ (MFC), for windows 2000.

To DanRolling:

I might have misled you, I am not working with the status bar, I was just using it as a example. I actually want to check or uncheck an item in the menu bar and by doing that change a Boolean variable. The same as in windows explorer you can make the status bar appear or disappears by checking or uncheck the menu item under View menu.

Thanks
Matt
0
 

Author Comment

by:mrfard
ID: 6490348
Dan;

I read your solution aging and it is exactly what I need.

Thanks
Matt
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

618 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