TabStripName and TabStripIndex properties

Purpose

The TabStripIndex property returns whether the Frame is part of a TabStrip Ocx.

Syntax

% = object. TabStripIndex

Tab.TabStripName

object:Frame, Form, Image

Description

The TabStripIndex property returns the index of the Tab if it is owned by a TabStrip Ocx. If it is not part of a TabStrip it returns 0.

TabStripName returns a string containing the Ocx name of the TabStrip parent the Tab belongs to.

Example

Form Hidden Center frm1 = "TabStrip", , , 400, 300

Ocx TabStrip tbs = , 20, 20, ScaleWidth - 40, ScaleHeight - 40

Ocx Frame fr1 = "Tab #1"

Ocx Frame fr2 = "Tab #2"

Ocx Frame fr3 = "Tab #3"

Ocx Frame fr4 = "Tab #4"

OcxOcx fr1 Option opt1 = "Option #1", 20, 20, 80, 24

OcxOcx fr1 Option opt2 = "Option #2", 20, 50, 80, 24

OcxOcx fr2 CheckBox chk1 = "Check #1", 20, 20, 80, 24

OcxOcx fr2 CheckBox chk2 = "Check #2", 20, 50, 80, 24

OcxOcx fr3 TextBox txt1 = "TextBox #1", 20, 20, 280, 40

OcxOcx fr3 TextBox txt2 = "TextBox #2", 20, 130, 280, 40

OcxOcx fr4 Command cmd1 = "Command #1", 90, 20, 80, 24

OcxOcx fr4 Command cmd2 = "Command #2", 90, 50, 80, 24

tbs.Tabs.Add 1, , fr1.Caption , , fr1

tbs.AddItem 2, , fr2.Caption, , fr2

tbs.Add 3, , fr3.Caption, , fr3

tbs.AddItem 4, , fr4.Caption , , fr4

frm1.Show

Text 0, 0, "TabStripIndex: " & fr2.TabStripIndex & " name: " & tbs(2).TabStripName

frm1.Refresh

tbs(2).Selected = True

Do

Sleep

Until Me Is Nothing

 

Sub tbs_Change

Local tsi As Int32

Switch tbs.SelectedIndex

Case 1 : opt1.SetFocus : tsi = fr1.TabStripIndex

Case 2 : chk1.SetFocus : tsi = fr2.TabStripIndex

Case 3 : txt1.SetFocus : tsi = fr3.TabStripIndex

Case 4 : cmd1.SetFocus : tsi = fr4.TabStripIndex

EndSwitch

Text 0, 0, "TabStripIndex: " & tsi & " Name: " & tbs(tbs.SelectedIndex).TabStripName

End Sub

See Also

TabStrip, Frame, Form, Image

{Created by Sjouke Hamstra; Last updated: 24/10/2014 by James Gaite}