Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TabStop not working with option button 1

Status
Not open for further replies.

perplexd

Programmer
May 9, 2002
154
US
I'm trying to stop users using tab to stop on either of two option buttons inside a frame.

However after setting tabstop to false at both runtime and design time, pressing tab still allows the user to give focus to the option buttons.

Why is this happening and how do I get it to work?
 
If your frames .TabIndex = 0 ( Or one of the option buttons is ), and you have no controls on the form with TabStop set to True, pressing tab will give the first control in the frame the focus ( or the option button with Tabindex = 0 ).

You can set another ( visible ) control on the form to have TabIndex = 0. That should solve it.

Robert
 
The frame.tabindex does not exist, though tab will not stop on a frame.

I have plenty of other controls with TabStop set to true on the form, so that's not causing the problem either.

I have tried setting tabstop to false on a number of other controls and have no problem with it. However when setting tabstop to false for an option button it does not seem to work, whether or no the option buttons are in a frame.

Can anyone give more assistance please?
 
Sorry, it does work if they are not in a frame.
 
Setting the value to TRUE, in code, for one of the Option buttons (and maybe even calling the Click event in code), will set the Tab Stop back to TRUE.
So what you need to do, is after you set the value of the option button, or call the click event, you need to set the TabStop back to FALSE. [/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
CCLINT,

Is that behavior ( of the option button resetting tabstop to true ) a bug, or is it intentional?

Robert
 
Yes CCLINT you're right - whenever you call the click event the TabStop value is set back to zero.

Only one question...why???
 
? Microsoft 'feature' ? Let me know if this helps
________________________________________________________________
If you are worried about how to post, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
Here is the answer I gave to a similar question. I used advanced search and searched on "tabstop option" and checked "all words".
You can not tab through an Option Button group after an option has been set UNLESS you set TabStop=True for every option button in the group in the Click Event. This happens because when an option button is set, its tab stop is set to true and the tabstop property for every other option button in that group is set to false.
From the Docs
"A control whose TabStop property has been set to False still maintains its position in the actual tab order, even though the control is skipped when you cycle through the controls with the TAB key.

Note An option button group has a single tab stop. The selected button (that is, the button with its Value set to True) has its TabStop property automatically set to True, while the other buttons have their TabStop property set to False."
Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Sorry for not getting back sooner.

JohnYingling is correct, but just to add to it:

The Tabbing stops only on one option button in a group, as stated, and then continues with a control outside of the option button group. One of the reasons is so that the user doesn't tied up having to Tab through, say, 25 option buttons in order to reach a command button(if no mouse is used). Once a control group like the option button receives the focus, then then user can navigate through the option buttons using the arrow up or down key.
With out the Option button getting the focus, and Tab stop, you could not navigate through the other option buttons with the arrows - because the arrouw buttons can also be used to navigate to other controls outside of the option group as well, like using the Tab key (command buttons, SSTabs, etc)

[/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top