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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More TAB order problems.

Status
Not open for further replies.

markSaunders

Programmer
Joined
Jun 23, 2000
Messages
196
Location
GB
The situation:
Using the SSTAB (agghhhh) control. I have a field on [tt]SSTAB.Tab(2)[/tt] that I wish focus to be set to ([tt]field.setFocus[/tt] and [tt]SSTAB.Tab[/tt] = 2) when the user uses the TAB key out of the last field on [tt]SSTAB.Tab(1)[/tt].

I have tried capturing the [tt]vbTabKey[/tt] in the [tt]lastField_keyUp[/tt] event but VB just ignores this keypress? I get all to work fine if I select another key such as, say, P but this just isn't practical!

Any ideas PLEASE!!
cheers
Mark Saunders
:-)
 
I have used the LostFocus event of controls to accomplish this. Then I don't need to trap individual Keystrokes. Alas, the problem of making sure the User actually enters the field (e.g. GotFocus Occurs) remains.

For this one, I only know to have code in EVERY control's LostFocus event, which 'validates' the form's data as appropiate, or REFUSES to shift focus to anywhere - except on the specific Form/Tab/...

Still looking for a better answer to this part.



MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
the best two solutions i am considering appear to be

1) place a(n array of) small command button with [tt].caption[/tt] of &> and when the [tt]_click[/tt] event is triggered the [tt]sstab.tab[/tt] is set to the same as the [tt]command.index[/tt]+1
mainProbs: not MS 'standard', requires extra controls/prog etc

2) place a textBox as the last (tab stopped) item on each SSTAB. set the background to backColour, border to None and text to "". in the GotFocus event of the text box the application simply sets the next tab and the first control of the new tab with .setFocus.
mainProbs: requires an extra tab from the user. what if, in this instance of a record, the first control of the new tab is not enabled or visible? - thus the programming starts to get a little tricky!

still looking..
m
Mark Saunders
:-)
 
in the Sstab_Click event :

If SSTab1.Tab = 0 Then
txtNaam.SetFocus
ElseIf SSTab1.Tab = 1 Then
txtBtwnummer.SetFocus
ElseIf SSTab1.Tab = 2 Then
txtVerzendadres.SetFocus
End If
Eric De Decker
vbg.be@vbgroup.nl

Licence And Copy Protection AxtiveX
Source CodeBook for the programmer
 
cheers edderic,

the only problem i foresee with this is if the controls are flag dependant and may often be .enabled = false. the problem thus is maintainability as the code would soon grow out of control such as:
Code:
if control1.enabled = true and control1.visible = true then
 control1.setfocus else
   if control2.enabled = true etc. etc.

the application i'm doing is VERY flag dependant with the availability of a very large number of fields dependant on other settings etc.

cheers for the help off everyone, but due to the specifics i'll probably stick with the more standard effect of forcing the user to change tabs (ctrl+tab when the sstab header has focus) as per the Microsoft standard.
Mark Saunders :-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top