Menu items as radio buttons

  • Thread starter Thread starter RBrowning1958
  • Start date Start date
R

RBrowning1958

Hello,

Is there a way to group menu items so they act like radio buttons -
that is when one is checked the others in the same group are unchecked
- I'm looking for a property to group menu items but can't see it.
Delphi's VCL has GroupIndex for example.

Ta

Ray
 
Ray,

You would have to implement this yourself. The only thing that the
MenuItem class has to help with this is the RadioCheck property, to indicate
that a menu item that is checked is mutually exclusive from the others. You
still have to manually set the checked state of the other menu items in your
group.
 
Hello,

Is there a way to group menu items so they act like radio buttons -
that is when one is checked the others in the same group are unchecked
- I'm looking for a property to group menu items but can't see it.
Delphi's VCL has GroupIndex for example.

I don't believe there's anything of the sort in .net, though it isn't
hard to implement -- just use a generic handler for all the buttons, and
do something like:

private void emulateRadio_click(object sender, EventArgs e)
{
NumberOneToolStripButton.Enabled = (sender ==
NumberOneToolStripButton);
NumberTwoToolStripButton.Enabled = (sender ==
NumberTwoToolStripButton);
NumberThreeToolStripButton.Enabled = (sender ==
NumberThreeToolStripButton);
}


Chris.
 
Chris said:
private void emulateRadio_click(object sender, EventArgs e)
{
NumberOneToolStripButton.Enabled = (sender ==
NumberOneToolStripButton);
NumberTwoToolStripButton.Enabled = (sender ==
NumberTwoToolStripButton);
NumberThreeToolStripButton.Enabled = (sender ==
NumberThreeToolStripButton);
}


Chris.

Replacing Enabled with Checked, of course...

/Steps away from usenet before drinking coffee. :)

Chris.
 
Ray,

You would have to implement this yourself. The only thing that the
MenuItem class has to help with this is the RadioCheck property, to indicate
that a menu item that is checked is mutually exclusive from the others. You
still have to manually set the checked state of the other menu items in your
group.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)




Is there a way to group menu items so they act likeradiobuttons -
that is when one is checked the others in the same group are unchecked
- I'm looking for a property to group menu items but can't see it.
Delphi's VCL has GroupIndex for example.

Ray- Hide quoted text -

- Show quoted text -

Nicholas,

I am using VS 2005 and I don't see a property called RadioCheck - what
am I missing?

Ta

Ray
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top