Results 1 to 39 of 39

Thread: Inconsistency in radio button tab indices

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2011
    Posts
    152

    Inconsistency in radio button tab indices

    I've got several sets of radio buttons: Some inside a top-level groupbox, some inside lower-level groupboxes, and some on the form. All of them have their tab indices set appropriately and the TabStop property set to true. I want the user to be able to tab through every single radio button (not just the first in the group). The bottom-level groupboxes do this correctly, but the top-level groupboxes and the radio buttons directly on the form don't. The screencap shows which are which.

    Name:  screencap.png
Views: 2789
Size:  60.3 KB

    Is there a property of either the container or the radio buttons that governs whether they're considered a single control or multiple controls for tab index purposes? If not, why else would some of the controls, but not others, behave properly?

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Inconsistency in radio button tab indices

    Er ... I don't understand how your getting the 'correct' ones to work to be honest. It's supposed to be Tab to go from control to control (in this case container to container), arrow keys to move between the controls contained within a control/container.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2011
    Posts
    152

    Re: Inconsistency in radio button tab indices

    I thought tab index was inherited, ie, it goes to the container, then through all the contents of the container in order, and then on to the next container? Anyway that's how the rest of it is working (eg, I can tab to treatment number, then event number, then photo number).

  4. #4
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Inconsistency in radio button tab indices

    Nope. Tab uses the primary Controls array so it should only go from control to control. Panels, group boxes etc. then have their own control arrays and you navigate those with the arrow keys. It's effectively a tree structure with Tab navigating the first level nodes only (or at least that's how it's supposed to be).
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2011
    Posts
    152

    Re: Inconsistency in radio button tab indices

    Huh, good to know ("tab index" is a somewhat deceptive name then, but that's neither here nor there). Of course that leaves it a total mystery why my controls are behaving the way they are.

    In my program, arrow keys change which radio button is checked, not which one has focus. They change the focus of checkboxes and buttons (like they're supposed to); for numericupdowns, listboxes, etc, the up/down keys of course change the value and the left/right keys do nothing.

  6. #6
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: Inconsistency in radio button tab indices

    There is a visual tab helper, go to the menu View> Tab Order, each control will overlapped with a number, click on these number in the order you want.



  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Oct 2011
    Posts
    152

    Re: Inconsistency in radio button tab indices

    That's a really handy tool, but the trouble is that the tab order it displays doesn't match the behavior. The radio buttons at the top are 0.0.0.0, 0.0.0.1, 0.0.0.2, 0.0.0.3, 0.0.0.4, and 0.0.0.5, which is what I want, but when I'm actually tabbing through, it skips all of them except the currently checked one.

  8. #8
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: Inconsistency in radio button tab indices

    This is standard behavior for RadioButton control, you can see this behavior in all Windows programs, e.g. the Notepad find dialog box.



  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Oct 2011
    Posts
    152

    Re: Inconsistency in radio button tab indices

    Yes, but the weird part is it doesn't do it for all of them. The controls circled in green do what I want (tab goes through all of them regardless of checkstate). I'm trying to figure out why those controls are different and how I can replicate that behavior for the others.

  10. #10
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: Inconsistency in radio button tab indices

    There is no weird because the controls circled in green are in different container (as i see)
    Last edited by 4x2y; May 21st, 2013 at 04:56 PM. Reason: Fix typo



  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Oct 2011
    Posts
    152

    Re: Inconsistency in radio button tab indices

    Not sure I follow. When I try to tab through the top (red-circled) container, tabbing does what you say. But when I tab through one of the green-circled containers, tab goes through every radio button (it goes from Yes to No to Any). Why do the different containers have different behaviors? What's different about them?

  12. #12
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: Inconsistency in radio button tab indices

    tab goes through every radio button (it goes from Yes to No to Any).
    Is tab goes to yes, no, any in the same group?

    From your screen shoot, you have three group boxes "High Wind", "Direct sun" and "Precipitation"

    BTW: if there isn't any radio button checked, the tab goes to everyone until you check one.



  13. #13
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: Inconsistency in radio button tab indices

    Quote Originally Posted by dunfiddlin View Post
    Nope. Tab uses the primary Controls array so it should only go from control to control. Panels, group boxes etc. then have their own control arrays and you navigate those with the arrow keys. It's effectively a tree structure with Tab navigating the first level nodes only (or at least that's how it's supposed to be).
    This is the behavior I'm observing.

    I have to concur with 4x2y's conclusion, the correct ones you highlighted are in different containers. I've never observed tab hitting one that wasn't checked. Are you sure that the behavior you described is what you observed ? We can confirm that if you post a screenshot with the focus rectangle around one of the RadioButtons that is unchecked since normal UI behavior would not allow you focus an unchecked RadioButton....at least not where I am.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  14. #14

    Thread Starter
    Addicted Member
    Join Date
    Oct 2011
    Posts
    152

    Re: Inconsistency in radio button tab indices

    Behold the impossible!

    Name:  ss1.png
Views: 1485
Size:  2.9 KB

    The radio buttons are all in the same container and otherwise behave completely normally. Here's another screenshot highlighting behavior that, if I understand correctly, ought to be impossible: I shouldn't be able to use tab to move focus between these domainupdowns, because tab should move between containers and arrow keys should move between items in the domainupdown.

    Name:  ss2.png
Views: 1679
Size:  7.1 KB

    (Edit: never mind about that last bit; they actually are in different containers.)
    Last edited by colleen.boye; May 27th, 2013 at 01:46 PM.

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Oct 2011
    Posts
    152

    Re: Inconsistency in radio button tab indices

    I also did this:

    Code:
    MessageBox.Show("The parent of WindYes is: " & WindYes.Parent.Name.ToString & vbCrLf & "The parent of WindNo is: " & _
                                         WindNo.Parent.Name.ToString & vbCrLf & "The parent of WindAny is: " & WindAny.Parent.Name.ToString)
    Result:

    Name:  ss3.png
Views: 1543
Size:  12.6 KB

  16. #16
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Inconsistency in radio button tab indices

    Not sure what you want to hear at this point. Yes, as far as I know that behaviour is impossible. I cannot reproduce it no matter what properties I play with at any level from form down to individual controls. So either you have something somewhere different about those containers in which this works or the whole thing goes to pot once you have sufficient controls and containers on the form but it should not be doing that and any experienced user of Windows would not expect it to do that.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  17. #17

    Thread Starter
    Addicted Member
    Join Date
    Oct 2011
    Posts
    152

    Re: Inconsistency in radio button tab indices

    That's OK, does anyone else have any ideas?

  18. #18
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,414

    Re: Inconsistency in radio button tab indices

    it seems your red highlighted groups are working correctly + your green highlighted groups are not...

    Quote Originally Posted by http://msdn.microsoft.com/en-us/library/windows/desktop/bb545460.aspx
    Assign tabs stops to all interactive controls, including read-only edit boxes. Exceptions:
    • Group sets of related controls that behave as a single control, such as radio buttons. Such groups have a single tab stop.

  19. #19
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: Inconsistency in radio button tab indices

    The first screen shoot (attached to the post #14) is impossible using the tab key only, but it is clearly you are using the arrow keys too (which you didn't said before) because once the focus goes to the checked radio button (by the tab key), you can highlight the other buttons by arrow keys, it is useful to know which one will checked by pressing the <Space> key.

    I hope everything is clear to you now.



  20. #20

    Thread Starter
    Addicted Member
    Join Date
    Oct 2011
    Posts
    152

    Re: Inconsistency in radio button tab indices

    I swear to God, I am using the tab key and the tab key only. Here is a video.



    Paul: You're right; so now the question is, why are some of the controls not doing that?
    Last edited by colleen.boye; May 26th, 2013 at 07:04 PM.

  21. #21
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: Inconsistency in radio button tab indices

    no idea



  22. #22
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: Inconsistency in radio button tab indices

    Quote Originally Posted by colleen.boye View Post
    I swear to God, I am using the tab key and the tab key only. Here is a video.



    Paul: You're right; so now the question is, why are some of the controls not doing that?
    Now that is freaky as hell. I cannot reproduce that behavior. If you're not using any custom controls, could you strip out all form code and post the designer file for the Form. The idea is that there may be some condition being met somewhere there that is causing that as an emergent behavior.

    Also, I'm starting to wonder if Windows itself can be configured to behave differently.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  23. #23
    Frenzied Member IanRyder's Avatar
    Join Date
    Jan 2013
    Location
    Healing, UK
    Posts
    1,232

    Re: Inconsistency in radio button tab indices

    Hi,

    Jesus, that one took a while to find and I nearly gave up myself once or twice.

    The thing that I noticed in your Video was the incorrect behaviour of the GroupBox when it was entered since you had the third option selected and yet it was the first option that got highlighted. The default behaviour when entering a GroupBox is to highlight the Selected option if there is one otherwise the first option is highlighted.

    So thinking on the lines that there had to be something that had broken the relationship between the 3 RadioButtons, I finally found the culprit to be setting the AutoCheck property of each RadioButton to False.

    So long as the RadioButton's TabStop setting is set to True, this then causes the behaviour within the GroupBox to change so that the first Option is always highlighted when entering the GroupBox and each RadioButton is then highlighted in turn on the pressing of the Tab Key. I do not really understand enough about this behaviour yet so I will not try and explain why this happens at this point.

    However, there is one other thing I did notice which you have not mentioned and that is with the RadioButtons AutoCheck property set to False you are NOT actually able to change the Checked status of the RadioButton's? Have you noticed this yourself?

    To get the correct behaviour from the GroupBox and RadioButton's you need to set all the RadioButton's AutoCheck property back to True.

    Hope that helps.

    Cheers,

    Ian

  24. #24
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: Inconsistency in radio button tab indices

    @IanRyder

    You have solved the puzzle

    I didn't used or recognized AutoCheck before, i wonder what exactly reason for it! i mean why a programmer disallow a user from check a provided option?
    Last edited by 4x2y; May 27th, 2013 at 09:01 AM.



  25. #25
    Frenzied Member IanRyder's Avatar
    Join Date
    Jan 2013
    Location
    Healing, UK
    Posts
    1,232

    Re: Inconsistency in radio button tab indices

    I didn't used or recognized AutoCheck before, i wonder what exactly reason for it! i mean why a programmer disallow a user from check a provided option?
    I have no idea at this point. It could have just been a result of exploring different options to achieve the necessary results, but hopefully the OP will come back and let us know what they were actually trying to achieve so that we may be able to guide them in a better way.

    Over to you to respond collen.boye. I can make guess, but what are you actually trying to do here?

    Cheers,

    Ian

  26. #26

    Thread Starter
    Addicted Member
    Join Date
    Oct 2011
    Posts
    152

    Re: Inconsistency in radio button tab indices

    So thinking on the lines that there had to be something that had broken the relationship between the 3 RadioButtons, I finally found the culprit to be setting the AutoCheck property of each RadioButton to False.
    This is clever and I totally thought that was going to be it! However...

    Name:  ss4.png
Views: 1938
Size:  87.9 KB

    I can use the arrow keys to change the checked radio button, as normal.

  27. #27

    Thread Starter
    Addicted Member
    Join Date
    Oct 2011
    Posts
    152

    Re: Inconsistency in radio button tab indices

    Here's my designer file.

    Form7.designer.vb

  28. #28
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Inconsistency in radio button tab indices

    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  29. #29

    Thread Starter
    Addicted Member
    Join Date
    Oct 2011
    Posts
    152

    Re: Inconsistency in radio button tab indices

    ...Yes?

  30. #30
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Inconsistency in radio button tab indices

    Consistent UI design is something we all strive for. If we change the rules the end-user can get confused. I think we sometimes underestimate the benefits of that consistency.
    Last edited by dbasnett; May 28th, 2013 at 06:01 AM.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  31. #31
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: Inconsistency in radio button tab indices

    Quote Originally Posted by colleen.boye View Post
    Here's my designer file.

    Form7.designer.vb
    I tried it and it does reproduce the behavior on my PC. I haven't been able to figure out the cause just yet. I'll have to play around with it some more and get back to you.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  32. #32
    Frenzied Member IanRyder's Avatar
    Join Date
    Jan 2013
    Location
    Healing, UK
    Posts
    1,232

    Re: Inconsistency in radio button tab indices

    Hi,

    I think you have inadvertently come across a bug within VS. Other than using your original Designer file that you posted, I am only able to replicate what is demonstrated in this Designer file by actually copying and pasting one of the offending GroupBox's into a new Form. I also think that you have ended up with multiple offending GroupBox's by doing the same thing as me and copying and pasting the original offending GroupBox within your Form.

    After a couple of hours playing I have NOT been able to identify what has caused this strange behaviour and the only thing I have been able to do is identify how to fix this behaviour so that the GroupBox's and the RadioButton's do what they are supposed to do. To fix this you just highlight the 3 RadioButton's in the GroupBox, go to properties and set the AutoCheck property to False and then immediately set the AutoCheck property back to True. This then seems to reset whatever the issue is back to the correct default behaviour of the GroupBox and RadioButton's.

    That's about as much as I can say so I hope it helps.

    Cheers,

    Ian

  33. #33
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: Inconsistency in radio button tab indices

    I found what is going on, it is TabStop property. When it is True, the tab key highlights the radio button even if there is another one checked in the same group.

    At design time when you add some RadioButton to a group box, each button has TabStop = True, once you set Checked = True for a button, the designer auto set TabStop = False for the others, therefore setting the TabStop to True again (manually) will make buttons behave like that.

    Anyway, i found another weird thing, the tab key highlights unchecked button until it reach to the checked one and skip all buttons comes after even if their property TabStop is True, that's explain why the buttons inside the group PrimaryKeyBox are not behave the same as button in WindGroupbox because the first button in PrimaryKeyBox is checked.
    Last edited by 4x2y; May 28th, 2013 at 09:45 AM.



  34. #34
    Frenzied Member IanRyder's Avatar
    Join Date
    Jan 2013
    Location
    Healing, UK
    Posts
    1,232

    Re: Inconsistency in radio button tab indices

    Hi,

    Well done 4x2y, that can definitely be replicated, and I think that this just confirms that this is a small bug in VS when it comes to using the GroupBox and RadioButton's since I do not think that Microsoft would have wanted the changing of these settings to change the actual behaviour of the GroupBox and the RadioButtons's.

    One to remember.

    Cheers,

    Ian

  35. #35
    New Member
    Join Date
    Jun 2013
    Posts
    1

    Re: Inconsistency in radio button tab indices

    The original poster, or an impersonator, did not appreciate your participation in this thread.

  36. #36
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: Inconsistency in radio button tab indices

    Quote Originally Posted by Detector View Post
    The original poster, or an impersonator, did not appreciate your participation in this thread.
    Rofl...how in God's name did you even find that. Also, didn't 4x2y solve the mystery already ? Why is she still complaining ?

    Also, she said she used a female name on the forum. Like what the hell is that about anyway ? I didn't even know colleen.boye was female until she posted the vid showing the tab behavior and it really doesn't make a difference. I'm not here looking for a mate.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  37. #37
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,414

    Re: Inconsistency in radio button tab indices

    Quote Originally Posted by Niya View Post
    Also, she said she used a female name on the forum. Like what the hell is that about anyway ? I didn't even know colleen.boye was female until she posted the vid showing the tab behavior and it really doesn't make a difference. I'm not here looking for a mate.
    apparently females get more immediate, closer attention

  38. #38
    Fanatic Member
    Join Date
    Dec 2007
    Location
    West Yorkshire, UK
    Posts
    791

    Re: Inconsistency in radio button tab indices

    Quote Originally Posted by Detector View Post
    The original poster, or an impersonator, did not appreciate your participation in this thread.
    On this thread, I see nothing more than dunfiddlin being dunfiddlin and then a group of programmers stumped, trying to find the explanation, then finding it and providing it. Nothing "mansplained" there. Some people are too quick to see themselves as victims I daresay.

  39. #39
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: Inconsistency in radio button tab indices

    Quote Originally Posted by .paul. View Post
    apparently females get more immediate, closer attention
    Quote Originally Posted by Españolita View Post
    Some people are too quick to see themselves as victims I daresay.
    Classic female rationalization.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width