
-----------------------------------
McKenzie
Mon May 22, 2006 8:41 am

Tab Index (controlling Tab order)
-----------------------------------
Controlling the Tab Oder in VB is fairly basic.  There are two properties that you need to look at: Tab Index and Tab Stop. When your application starts the control with Tab Index zero will get focus then as you hit the tab key focus will jump, in Tab Index order, from control to control. If you don't want a control to get focus by hitting the tab key set its Tab Stop to false.

Basic Design Tips
~~~~~~~~~~~
Western Society reads left to right, top to bottom.  Your form should follow that basic order.  There are times when you want to deviate from this but at very least start in the top left corner and finish in the bottom right.

Why do labels have a tab Index if you can never give them focus? Your labels should have a Tab Index one less than the text box that it is being the label for.  Give your label a keyboard shortcut (by placing an & before the shortcut key in the caption property) then when the user uses the shortcut to the label the text box will get focus.

-----------------------------------
ToughRouge
Mon May 22, 2006 8:48 am


-----------------------------------
I see... thanks for the tip... but how do you make a tab?

-----------------------------------
cool dude
Mon May 22, 2006 12:04 pm


-----------------------------------
to make the tab its really simple. basically double click on your form. once your code window opens change the event on your form to keypress. then type in this code:


Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = 9 Then
        TabIndex = 1
    End If
End Sub

i hope this helps!

-----------------------------------
ToughRouge
Mon May 22, 2006 12:12 pm


-----------------------------------
I don't see the tabs. =/... I'm a beginner in VB so I probably did something wrong.  :( 
But I also want to know... when you switch between tabs, do you load a different form, or is it just a different page in the form or something?

-----------------------------------
GlobeTrotter
Mon May 22, 2006 2:04 pm


-----------------------------------
I think there is some major miscommunication going on.  From what I gather, ToughRouge is reffering to tab objects, ones you click on that act like frames.  McKenzie is refering to the order things are hilighted when you actually press the tab key.

I'm not entirely sure, ToughRouge, but I believe you will have to press CTRL+T on the form and look for a tab object.  Then, you can simply drag it onto the form.

-----------------------------------
McKenzie
Mon May 22, 2006 6:44 pm


-----------------------------------
Opps  :oops: , you mean the TabStrip control.  Not quite as easy.  The TabStrip does not work quite as nicely as you would like it to. You would expect that at design time you could simply paint stuff on each of the Tabs and let VB handle stuff in the background.  Not so. OK, here is how it works:

1. Add the cutom control: R-Click the tool, Components, MS Common Controls 6.0.  Draw on your TabStrip.

2. Set the properties.  There are loads of properties with TabStrips. The most important is the setting of the actual Tabs. To do this access the custom property (or R-Click, properties) go to the Tabs tab and your tabs and set their captions.

3. The Best way to set up the contents for the TabStrip is to have a control array of Frames.  Set the borders of the frames to none and the visibility of all but the first one to false.

4. As the user selects Tabs set the visibility of the respective frame to true and the old one to false.

I've included an example.

-----------------------------------
ToughRouge
Mon May 22, 2006 8:17 pm


-----------------------------------
Thanks for the example, I get it now.

But whats the difference between TabStrip Control and the SSTab Control that you can find on Microsoft Tab Dialog Control 6.0 (SP6). On the Tab Dialog control, I find that you don't have to use the frames to make things visible or not. So... which one is better?

I attached a crude example of what I was talking about.

-----------------------------------
McKenzie
Tue May 23, 2006 7:31 am


-----------------------------------
I'm sure there is a reason for using the TabStrip, but you're right the ssTab is much easier.

-----------------------------------
ToughRouge
Tue May 23, 2006 6:49 pm


-----------------------------------
OK, for the SSTab, I still have one question... The conventional naming thing ( the three letter one, for ex. checkbox = chk)... I couldn't find the name for it. Does anyone know the three letter name? Or is it just Tab...?

-----------------------------------
NikG
Thu Jun 01, 2006 11:28 pm


-----------------------------------
The conventions are not necessarily geared towards specific controls, but rather to the purpose of the control.  If you are saying that TabStrip and SSTab serve similar purposes and that TabStrip normally has a tab convention, why not use the same one?

-----------------------------------
NikG
Thu Jun 01, 2006 11:29 pm


-----------------------------------
On an unrelated note: WOO, that post made me a newbe hacker.
