Solved

Windows Programming - Menus

Posted on 2004-04-22
3
212 Views
Last Modified: 2010-04-17
Hi,

I have a menu using check marks.  Each time I select an option from the menu I want the option to be checked and all other options to be unchecked.  Does anybody know how I can "refresh" the menu bar after selecting an option as after selecting nothing is changing.

Thanks,
Adrian
0
Comment
Question by:Adrian_Buz
3 Comments
 
LVL 1

Expert Comment

by:curt_henderson
ID: 10893121
What development environment are you using?
0
 

Author Comment

by:Adrian_Buz
ID: 10894460
I'm using C
0
 
LVL 1

Accepted Solution

by:
edkaas earned 50 total points
ID: 10904525
In my example:
Create 5 items in the menu the Main one ListItem1 beneath that one 2,3,4 and 5

then use this code:
private void menuItem2_Click(object sender, System.EventArgs e)
{
      CheckUncheck(this.menuItem2);
}

private void menuItem3_Click(object sender, System.EventArgs e)
{
      CheckUncheck(this.menuItem3);
}

private void menuItem4_Click(object sender, System.EventArgs e)
{
      CheckUncheck(this.menuItem4);
}

private void menuItem5_Click(object sender, System.EventArgs e)
{
                 CheckUncheck(this.menuItem5);
}
private void CheckUncheck(MenuItem ClickedItem)
{
      foreach(MenuItem myItem in menuItem1.MenuItems)
      {
            if(myItem.Text != ClickedItem.Text)
            myItem.Checked = false;
            else
            myItem.Checked = true;
      }
}

Take care,

Ed
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

708 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

12 Experts available now in Live!

Get 1:1 Help Now