Attached is a simplified form that works similar to a project I am working on... you will notice you can tab through each field and then click the button.. which clears the form and sets focus back to the first control.. but then when you tab through.. it skips over the option buttons and goes from the first textbox to the second... is there a way around this??? When the form clears I need the tab order to stay intact and not skip over them...
I know I can look for a tab key in the control before the options.. but it doesn't seem right for it to behave this way
if both options are NOT cleared.. then the one that is true will get focus.. but if both are false they dont.. but on the first pass though they are both false and still get focus...
For some reason it does not let you tab to an unselected option group.
Set one of the option group to a default value and it will work okay.
I'm guessing is a side-effect of design, since you can't be on an unselected option control, when you tab on it, or cursor to it, it selects, not just highlight. Know what I mean?
For some reason it does not let you tab to an unselected option group.
Set one of the option group to a default value and it will work okay.
I'm guessing is a side-effect of design, since you can't be on an unselected option control, when you tab on it, or cursor to it, it selects, not just highlight. Know what I mean?
but did you notice that when both are unselected when you first run the app.. it works how it should... its only after you clear the options via code that it skips them...
and i cant set one as default because this is how the specs are set up
Originally posted by kleinma but did you notice that when both are unselected when you first run the app.. it works how it should... its only after you clear the options via code that it skips them...
and i cant set one as default because this is how the specs are set up
You can programmatically set the focus though. Check on the text boxe's lostfocus if the focus is changed using tab ... if it is set the focus to one of two options.
Originally posted by techyspecy You can programmatically set the focus though. Check on the text boxe's lostfocus if the focus is changed using tab ... if it is set the focus to one of two options.
yeah i know.. just seems like a shady work around for it... but it would probably be on the keypress of the previous control.. because the lostfocus wont give me a keycode value
Originally posted by kleinma yeah i know.. just seems like a shady work around for it... but it would probably be on the keypress of the previous control.. because the lostfocus wont give me a keycode value
What do you need keycode value for ??
you could use this ..
VB Code:
Option Explicit
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Private Const VK_TAB = &H9
Private Sub Text2_LostFocus()
If GetTabState Then MsgBox "You just tabbed out of Text2"
End Sub
Private Sub Text1_LostFocus()
If GetTabState Then MsgBox "You just tabbed out of Text1"
kleinma: The problem is that for some reason the TabStop property gets set to False after tabbing through it the first time. My code above fixes that and it works for me. Did it fix your problem?
Originally posted by MartinLiss kleinma: The problem is that for some reason the TabStop property gets set to False after tabbing through it the first time. My code above fixes that and it works for me. Did it fix your problem?
yeah it did.. thanks.. i didn't even see your post at first... i was going to look at that.. but i didn't see why changing the value property would change any other property...
It takes the tab stop property off of option boxes that are not selected.
setting the option value to false, or selecting a different option in a group will set the tab stop prop to false.
I think it's so that when you get around to tabbing back to the group of options,
it will highlight the selected option, since being on an option will select it.