7 Replies - 2594 Views - Last Post: 22 June 2012 - 12:49 PM Rate Topic: -----

#1 Criel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 130
  • Joined: 11-March 11

The age old question, Radio buttons and group boxes

Posted 21 June 2012 - 09:07 AM

There are a ton of these on Google, however none of those seem to work in my situation. How is this actually possible? I understand because it has to be ON/OFF it won't go through to any other radio buttons in the group box. Would the best way is to use a hidden radio button that would switch control between the two? There's only two radio buttons i need to tab through, what's the best way to tackle this?
Is This A Good Question/Topic? 0
  • +

Replies To: The age old question, Radio buttons and group boxes

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9579
  • View blog
  • Posts: 36,293
  • Joined: 12-June 08

Re: The age old question, Radio buttons and group boxes

Posted 21 June 2012 - 09:11 AM

Reexplain your problem and what you are trying to do. I am not understanding it.
Was This Post Helpful? 0
  • +
  • -

#3 Criel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 130
  • Joined: 11-March 11

Re: The age old question, Radio buttons and group boxes

Posted 21 June 2012 - 09:25 AM

I"m just trying to tab between two radio buttons in one groupbox. It will tab to one then skip to the next component on the form. i'm just looking for a possible solution to how to get it to tab between the two radio buttons.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9579
  • View blog
  • Posts: 36,293
  • Joined: 12-June 08

Re: The age old question, Radio buttons and group boxes

Posted 21 June 2012 - 09:29 AM

Wait - so you want the tab key to become stuck in a cycle between two controls? Hmm.. odd, but you would just tap into the leave event of each.. if leaving one then force the focus on to the other radio button.. and vice versa.
http://msdn.microsof...ton_events.aspx
Was This Post Helpful? 1
  • +
  • -

#5 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: The age old question, Radio buttons and group boxes

Posted 21 June 2012 - 07:20 PM

The standard Microsoft keyboard handling of radio buttons is to use the arrow keys. Tab to the group of buttons, then arrow to the one you want, then select it with the spacebar or enter key. Spacebar is usually more consistent, as the enter key might be taken to select a default command button. So, the solution is to train your users on Windows keyboard navigation.

For an eye-opening overview of this subject, see here.

If you want to improve your application, try to use it without the mouse and see how far you get. :) You should be able to support users who have physical handicaps and can't use it.

This post has been edited by BobRodes: 21 June 2012 - 07:22 PM

Was This Post Helpful? 1
  • +
  • -

#6 Luc001  Icon User is offline

  • D.I.C Addict

Reputation: 84
  • View blog
  • Posts: 617
  • Joined: 04-May 09

Re: The age old question, Radio buttons and group boxes

Posted 22 June 2012 - 12:32 AM

Hi,

You might consider using a CheckBox rather than a RadioButton. You can use the Appearance property to make a CheckBox look just like a Button but it will remain depressed when you click it the first time and then pop out when you click it again. You can then use the Checked property of the CheckBox to determine state.
Was This Post Helpful? 0
  • +
  • -

#7 Criel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 130
  • Joined: 11-March 11

Re: The age old question, Radio buttons and group boxes

Posted 22 June 2012 - 12:21 PM

I appreciate the helpful replies. I would love to just use arrow keys, it would make my life a whole lot easier. :)

I've been fiddling around with the leave event and am having one issue it will switch the radio buttons just fine but once focus is lost(example, user clicking submit button) it will cause the radio button to revert.

Private Sub optOn_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles optOn.Leave
        If My.Computer.Keyboard.ShiftKeyDown And Keys.Tab Then
            lvwReportDetails.Focus()
        ElseIf Keys.Tab Then
            optOff.Checked = True
            optOff.Focus()
        Else
            optOn.Focus()
            optOn.Checked = True
        End If


If the user clicks tab it will go to the off button fine, but if the user wants to turn a select item on, upon leaving the second if statement will trigger as true(even if the user didn't hit the tab key, for example just clicking a button on the form triggers true). Since I can't use e.keycode with the leave event is there a reason the tab is getting triggered as true when it's not?

Thanks for all the help!!!
Was This Post Helpful? 0
  • +
  • -

#8 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: The age old question, Radio buttons and group boxes

Posted 22 June 2012 - 12:49 PM

I repeat: users don't tab between radio buttons. They tab into the group of buttons, navigate around them using arrow keys, select/deselect using spacebar, and then tab to the next control. This has been standard behavior since the 70's, when Xerox invented the whole thing, and has been in widespread use since the first Mac came out in 1983. (I know; I used to own one. :) )

You don't explain why you are requiring the user to deviate from standard Windows keyboard behaviors. What is your compelling business reason (or your boss's, perhaps) to require significant additional development overhead, reduced user acceptance, and a steeper learning curve of your users? Presumably, those who use the keyboard to navigate are used to doing it the normal way.

@Luc: you don't decide to use one or the other for cosmetic reasons. The sole reason to choose between radio buttons and checkboxes is that only one radio button in a group can be checked at a time, whereas any number of checkboxes can be. The OP says that he has two buttons, presumably with mutually exclusive choices associated with them. You should NOT use checkboxes if this is the case.

This post has been edited by BobRodes: 22 June 2012 - 12:58 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1