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

SSTab and Controlling Tab Order for Controls

Status
Not open for further replies.

evoluder

MIS
Dec 4, 2001
21
0
0
US
Hello,

I have a SSTab control on a form. There are three tabs, each tab contains multiple textboxes, checkboxes, and comboboxes. I am using a code snippet provided in a VB6 book to prevent the focus moving off of the current SSTab.Tab if the user tabs through the input controls. The code is as follows:

Sub ChangeTab(SSTab As SSTab)
Dim ctrl As Control, TabIndex As Long
TabIndex = 99999
On Error Resume Next

For Each ctrl In SSTab.Parent.Controls
If ctrl.Container Is SSTab Then
If ctrl.Left < -10000 Then
ctrl.Enabled = False
Else
ctrl.Enabled = True
If ctrl.TabIndex >= TabIndex Then
Else
TabIndex = ctrl.TabIndex
ctrl.SetFocus
End If
End If
End If
Next
End Sub

The code works as intended, if you tab through the controls you will move from the last control to the first on that tab. However, when this code is executed (triggered by SSTab1_Click) it disables the menu items for frmMain. My understanding is that the menu is not within the SSTab container, but I don't know why it would be affected if it wasn't. Am I doing something strange? Is there another way to handle this?

Thank you very much for any assistance.

Regards.
 
The trouble here is that the parent of your SSTab
is your form, so you are disabling all controls on
the form.

How about putting a command in the &quot;LostFocus&quot;
event of the object on the tab with the highest
tabindex to set the focus to the item on the tab
with the lowest tabindex.

e.g.

Private Sub Text10_LostFocus()
Text1.SetFocus
End Sub


hope this helps

:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top