Menu items as radio buttons

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RBrowning1958@gmail.com

    #1

    Menu items as radio buttons

    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

  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Menu items as radio buttons

    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]
    - mvp@spam.guard. caspershouse.co m

    <RBrowning1958@ gmail.comwrote in message
    news:1194295177 .766599.289810@ 19g2000hsx.goog legroups.com...
    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
    >

    Comment

    • Chris Shepherd

      #3
      Re: Menu items as radio buttons

      RBrowning1958@g mail.com wrote:
      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_cl ick(object sender, EventArgs e)
      {
      NumberOneToolSt ripButton.Enabl ed = (sender ==
      NumberOneToolSt ripButton);
      NumberTwoToolSt ripButton.Enabl ed = (sender ==
      NumberTwoToolSt ripButton);
      NumberThreeTool StripButton.Ena bled = (sender ==
      NumberThreeTool StripButton);
      }


      Chris.

      Comment

      • Chris Shepherd

        #4
        Re: Menu items as radio buttons

        Chris Shepherd wrote:
        private void emulateRadio_cl ick(object sender, EventArgs e)
        {
        NumberOneToolSt ripButton.Enabl ed = (sender ==
        NumberOneToolSt ripButton);
        NumberTwoToolSt ripButton.Enabl ed = (sender ==
        NumberTwoToolSt ripButton);
        NumberThreeTool StripButton.Ena bled = (sender ==
        NumberThreeTool StripButton);
        }
        >
        >
        Chris.
        Replacing Enabled with Checked, of course...

        /Steps away from usenet before drinking coffee. :)

        Chris.

        Comment

        • RBrowning1958@gmail.com

          #5
          Re: Menu items as radio buttons

          On Nov 5, 9:06 pm, "Nicholas Paldino [.NET/C# MVP]"
          <m...@spam.guar d.caspershouse. comwrote:
          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]
          - m...@spam.guard .caspershouse.c om
          >
          <RBrowning1...@ gmail.comwrote in message
          >
          news:1194295177 .766599.289810@ 19g2000hsx.goog legroups.com...
          >
          >
          >
          Hello,
          >
          Is there a way to group menu items so they act likeradiobutton s -
          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- 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

          Comment

          Working...