Option buttons or check boxes


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 1 of 3 123 LastLast
Results 1 to 15 of 40

Thread: Option buttons or check boxes

  1. #1
    Matt Guest

    Option buttons or check boxes


    I am making a program and I want to either a radio button or check boxes to
    make something appear when one of the boxes or buttons are checked. Here
    is my problem I want the program to start with none of the boxes or buttons
    check, but I also only want to be able to check one boxes or button, I don't
    want more than one chosen. I can do this with buttons, but with buttons
    the program starts with a button check and with boxes you can check more
    than one box.

    Thx

  2. #2
    Arthur Wood Guest

    Re: Option buttons or check boxes


    Matt,
    Make the Check boxes members of a control array, and then, in the CheckBock_Click(Index)
    procedure, you can turn off all of the checkboxes when one is checked, and
    then turn ON only the one indicated by the Index passed to the procedure.
    That should accomplish what you want.

    Arthur Wood


    "Matt" <mattejunk@hotmail.com> wrote:
    >
    >I am making a program and I want to either a radio button or check boxes

    to
    >make something appear when one of the boxes or buttons are checked. Here
    >is my problem I want the program to start with none of the boxes or buttons
    >check, but I also only want to be able to check one boxes or button, I don't
    >want more than one chosen. I can do this with buttons, but with buttons
    >the program starts with a button check and with boxes you can check more
    >than one box.
    >
    >Thx



  3. #3
    Bob Butler Guest

    Re: Option buttons or check boxes


    "Matt" <mattejunk@hotmail.com> wrote in message
    news:3c3a2a69@147.208.176.211...
    >
    > I am making a program and I want to either a radio button or check boxes

    to
    > make something appear when one of the boxes or buttons are checked. Here
    > is my problem I want the program to start with none of the boxes or

    buttons
    > check, but I also only want to be able to check one boxes or button, I

    don't
    > want more than one chosen. I can do this with buttons, but with buttons
    > the program starts with a button check and with boxes you can check more
    > than one box.


    Two options:
    1) add another "none of the above" option button and make that True by
    default
    2) add code after the form is loaded and shown to clear the option box; VB
    sets one true if all are false when it loads the controls but you can
    override that




  4. #4
    Dean Earley Guest

    Re: Option buttons or check boxes

    "Arthur Wood" <wooda@saic-trsc.com> wrote in message news:3c3a4ae9$1@147.208.176.211...
    >
    > Matt,
    > Make the Check boxes members of a control array, and then, in the CheckBock_Click(Index)
    > procedure, you can turn off all of the checkboxes when one is checked, and
    > then turn ON only the one indicated by the Index passed to the procedure.


    NO! NO! NO!
    Bad Boy )

    Thats what radio buttons are for )
    Have a loot at: http://www.iarchitect.com/mshame.htm "selecting the wrong control"

    --
    Dean Earley (dean.earley@icode.co.uk)
    Assistant Developer

    iCode Systems



  5. #5
    Jon Oliver Guest

    Re: Option buttons or check boxes


    "Dean Earley" <dean.earley@icode.co.uk> wrote in message
    news:3c3aff33@147.208.176.211...
    > "Arthur Wood" <wooda@saic-trsc.com> wrote in message

    news:3c3a4ae9$1@147.208.176.211...
    > >
    > > Matt,
    > > Make the Check boxes members of a control array, and

    then, in the CheckBock_Click(Index)
    > > procedure, you can turn off all of the checkboxes when one

    is checked, and
    > > then turn ON only the one indicated by the Index passed to

    the procedure.
    >
    > NO! NO! NO!
    > Bad Boy )
    >
    > Thats what radio buttons are for )
    > Have a loot at: http://www.iarchitect.com/mshame.htm

    "selecting the wrong control"

    This is a great site, but it neglects one difference, though.

    You can't reliably have no selection in a set of option buttons.
    With a set of exclusive check boxes, you can. Personally, I
    would go for a set of options buttons that included a "None"
    option, but there is some quality to the alternative argument.



  6. #6
    Jon Oliver Guest

    Re: Option buttons or check boxes


    "Bob Butler" <butlerbob@earthlink.net> wrote in message
    news:3c3a5be9@147.208.176.211...
    >
    > "Matt" <mattejunk@hotmail.com> wrote in message
    > news:3c3a2a69@147.208.176.211...
    > >
    > > I am making a program and I want to either a radio button or

    check boxes
    > to
    > > make something appear when one of the boxes or buttons are

    checked. Here
    > > is my problem I want the program to start with none of the

    boxes or
    > buttons
    > > check, but I also only want to be able to check one boxes or

    button, I
    > don't
    > > want more than one chosen. I can do this with buttons, but

    with buttons
    > > the program starts with a button check and with boxes you

    can check more
    > > than one box.

    >
    > Two options:
    > 1) add another "none of the above" option button and make that

    True by
    > default
    > 2) add code after the form is loaded and shown to clear the

    option box; VB
    > sets one true if all are false when it loads the controls but

    you can
    > override that


    It will also default one when the group get's focus.



  7. #7
    Bob Butler Guest

    Re: Option buttons or check boxes


    "Jon Oliver" <joliver@no.spam.maam.com> wrote in message
    news:3c3b0cf1$1@147.208.176.211...
    <cut>
    > It will also default one when the group get's focus.


    True. A 'None' option is usually the best approach. It keeps the standard
    action on the controls and is more explicit for the user.




  8. #8
    Rick Rothstein Guest

    Re: Option buttons or check boxes

    > You can't reliably have no selection in a set of option buttons.

    Try setting all of their Value(s) to False in the Form_Activate event and see what
    happens.

    Rick


  9. #9
    Rick Rothstein Guest

    Re: Option buttons or check boxes

    How does the "group" get focus?

    Rick


    "Jon Oliver" <joliver@no.spam.maam.com> wrote in message
    news:3c3b0cf1$1@147.208.176.211...
    >
    > "Bob Butler" <butlerbob@earthlink.net> wrote in message
    > news:3c3a5be9@147.208.176.211...
    > >
    > > "Matt" <mattejunk@hotmail.com> wrote in message
    > > news:3c3a2a69@147.208.176.211...
    > > >
    > > > I am making a program and I want to either a radio button or

    > check boxes
    > > to
    > > > make something appear when one of the boxes or buttons are

    > checked. Here
    > > > is my problem I want the program to start with none of the

    > boxes or
    > > buttons
    > > > check, but I also only want to be able to check one boxes or

    > button, I
    > > don't
    > > > want more than one chosen. I can do this with buttons, but

    > with buttons
    > > > the program starts with a button check and with boxes you

    > can check more
    > > > than one box.

    > >
    > > Two options:
    > > 1) add another "none of the above" option button and make that

    > True by
    > > default
    > > 2) add code after the form is loaded and shown to clear the

    > option box; VB
    > > sets one true if all are false when it loads the controls but

    > you can
    > > override that

    >
    > It will also default one when the group get's focus.
    >
    >



  10. #10
    Jon Oliver Guest

    Re: Option buttons or check boxes


    "Rick Rothstein" <rick_newsgroup@email.com> wrote in message
    news:3c3c340e@147.208.176.211...
    > > You can't reliably have no selection in a set of option

    buttons.
    >
    > Try setting all of their Value(s) to False in the

    Form_Activate event and see what
    > happens.


    It lasts only as long as the group does not receive focus. I
    wouldn't call it gospel, but I don't think that tabbing through
    controls should result in an edit.



  11. #11
    Jon Oliver Guest

    Re: Option buttons or check boxes

    Drop a TextBox and 3 OptionButtons on a form (in that order) in
    a default Standard EXE project. When you run the program, Form1
    should have the text box in focus, and the option buttons will
    all be unselected. Tab takes you to the option group
    (additional tabs do not go to the next optionbutton) and selects
    the first optionbutton.

    "Rick Rothstein" <rick_newsgroup@email.com> wrote in message
    news:3c3c355a$1@147.208.176.211...
    > How does the "group" get focus?
    >
    > Rick
    >
    >
    > "Jon Oliver" <joliver@no.spam.maam.com> wrote in message
    > news:3c3b0cf1$1@147.208.176.211...
    > >
    > > "Bob Butler" <butlerbob@earthlink.net> wrote in message
    > > news:3c3a5be9@147.208.176.211...
    > > >
    > > > "Matt" <mattejunk@hotmail.com> wrote in message
    > > > news:3c3a2a69@147.208.176.211...
    > > > >
    > > > > I am making a program and I want to either a radio

    button or
    > > check boxes
    > > > to
    > > > > make something appear when one of the boxes or buttons

    are
    > > checked. Here
    > > > > is my problem I want the program to start with none of

    the
    > > boxes or
    > > > buttons
    > > > > check, but I also only want to be able to check one

    boxes or
    > > button, I
    > > > don't
    > > > > want more than one chosen. I can do this with buttons,

    but
    > > with buttons
    > > > > the program starts with a button check and with boxes

    you
    > > can check more
    > > > > than one box.
    > > >
    > > > Two options:
    > > > 1) add another "none of the above" option button and make

    that
    > > True by
    > > > default
    > > > 2) add code after the form is loaded and shown to clear

    the
    > > option box; VB
    > > > sets one true if all are false when it loads the controls

    but
    > > you can
    > > > override that

    > >
    > > It will also default one when the group get's focus.
    > >
    > >

    >




  12. #12
    Rick Rothstein Guest

    Re: Option buttons or check boxes

    That's not how it works on my system -- VB6SP3 on Win98SE. The Tab key will not send focus
    to the OptionButton group if no one of them is selected.

    I set all of the OptionButton Value(s) to False in the Form_Load event. Doing this means
    that no OptionButton will be selected. And when none is selected, then none appear able to
    take focus. Only after one of them has been selected can the Tab key give focus to the
    group (the selected OptionButton only, to be exact).

    Rick


    "Jon Oliver" <joliver@no.spam.maam.com> wrote in message
    news:3c3c6716$1@147.208.176.211...
    > Drop a TextBox and 3 OptionButtons on a form (in that order) in
    > a default Standard EXE project. When you run the program, Form1
    > should have the text box in focus, and the option buttons will
    > all be unselected. Tab takes you to the option group
    > (additional tabs do not go to the next optionbutton) and selects
    > the first optionbutton.
    >
    > "Rick Rothstein" <rick_newsgroup@email.com> wrote in message
    > news:3c3c355a$1@147.208.176.211...
    > > How does the "group" get focus?
    > >
    > > Rick
    > >
    > >
    > > "Jon Oliver" <joliver@no.spam.maam.com> wrote in message
    > > news:3c3b0cf1$1@147.208.176.211...
    > > >
    > > > "Bob Butler" <butlerbob@earthlink.net> wrote in message
    > > > news:3c3a5be9@147.208.176.211...
    > > > >
    > > > > "Matt" <mattejunk@hotmail.com> wrote in message
    > > > > news:3c3a2a69@147.208.176.211...
    > > > > >
    > > > > > I am making a program and I want to either a radio

    > button or
    > > > check boxes
    > > > > to
    > > > > > make something appear when one of the boxes or buttons

    > are
    > > > checked. Here
    > > > > > is my problem I want the program to start with none of

    > the
    > > > boxes or
    > > > > buttons
    > > > > > check, but I also only want to be able to check one

    > boxes or
    > > > button, I
    > > > > don't
    > > > > > want more than one chosen. I can do this with buttons,

    > but
    > > > with buttons
    > > > > > the program starts with a button check and with boxes

    > you
    > > > can check more
    > > > > > than one box.
    > > > >
    > > > > Two options:
    > > > > 1) add another "none of the above" option button and make

    > that
    > > > True by
    > > > > default
    > > > > 2) add code after the form is loaded and shown to clear

    > the
    > > > option box; VB
    > > > > sets one true if all are false when it loads the controls

    > but
    > > > you can
    > > > > override that
    > > >
    > > > It will also default one when the group get's focus.
    > > >
    > > >

    > >

    >
    >



  13. #13
    Jon Oliver Guest

    Re: Option buttons or check boxes


    "Rick Rothstein" <rick_newsgroup@email.com> wrote in message
    news:3c3c7114$1@147.208.176.211...
    > That's not how it works on my system -- VB6SP3 on Win98SE. The

    Tab key will not send focus
    > to the OptionButton group if no one of them is selected.
    >
    > I set all of the OptionButton Value(s) to False in the

    Form_Load event. Doing this means
    > that no OptionButton will be selected. And when none is

    selected, then none appear able to
    > take focus. Only after one of them has been selected can the

    Tab key give focus to the
    > group (the selected OptionButton only, to be exact).


    I've noted that your a fastidious man, so your description is
    credible even though it is counter to behavior I've witnessed on
    a wide variety of VB and OS versions. Please don't take it as
    patronizing if I ask: Did you try the experiment I proposed?



  14. #14
    Bob Butler Guest

    Re: Option buttons or check boxes


    "Rick Rothstein" <rick_newsgroup@email.com> wrote in message
    news:3c3c7114$1@147.208.176.211...
    > That's not how it works on my system -- VB6SP3 on Win98SE. The Tab key

    will not send focus
    > to the OptionButton group if no one of them is selected.
    >
    > I set all of the OptionButton Value(s) to False in the Form_Load event.


    Interesting. If you set only the first option button's value to False in
    the Load event then tab takes you to the second button and "clicks" it.
    If you set the first two then the third one gets focus. If you set them all
    then none can get focus via TAB. Somebody must have been on something
    strong to come up with something like that!

    (VB6SP2 on Win2K pro)





  15. #15
    Rick Rothstein Guest

    Re: Option buttons or check boxes

    > > That's not how it works on my system -- VB6SP3 on Win98SE. The
    > Tab key will not send focus
    > > to the OptionButton group if no one of them is selected.
    > >
    > > I set all of the OptionButton Value(s) to False in the

    > Form_Load event. Doing this means
    > > that no OptionButton will be selected. And when none is

    > selected, then none appear able to
    > > take focus. Only after one of them has been selected can the

    > Tab key give focus to the
    > > group (the selected OptionButton only, to be exact).

    >
    > I've noted that your a fastidious man, so your description is
    > credible even though it is counter to behavior I've witnessed on
    > a wide variety of VB and OS versions. Please don't take it as
    > patronizing if I ask: Did you try the experiment I proposed?


    Yes, I even added an additional TextBox and watched the focus oscillate between the two
    TextBoxes only.

    Give what I posted a try. Add two TextBoxes and three OptionButtons (although you can add
    as many OptionButtons as you like). The order in which you add the controls should be
    unimportant. Now, put this in your Form_Load event

    Option1.Value = False
    Option2.Value = False
    Option3.Value = False

    and run the project. Repeatedly hit the Tab key and none of the three OptionButtons will
    receive focus. You must click on one of them to activate(?) the group. After clicking on
    any one of them, Tabbing will now include the selected OptionButton in its sequence. As
    long as the Value properties *all* OptionButtons in a group are set False, they will be
    excluded from receiving focus.

    Rick


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center