QTabControl Examples
'' Tab Control Example for Rapid-Q by William Yu
'' When you hide a container (like QFORM, QTABCONTROL, and QPANEL), all the
'' components within it are also hidden.
$INCLUDE "RAPIDQ.INC"
DECLARE SUB TabChange
CREATE MainForm AS QForm
Center
Height = 300
Width = 350
Caption = "Tab Control demo"
CREATE Tab AS QTabControl
AddTabs "Tab 1","Tab 2","Tab 3","Tab 4"
Width = MainForm.ClientWidth
Height = MainForm.ClientHeight
OnChange = TabChange
HotTrack = True
CREATE Panel0 AS QPanel
Top = 40
Left = 5
Width = Tab.ClientWidth - 10
Height = Tab.ClientHeight - 50
Caption = "Panel 1"
BevelInner = bvLowered
CREATE Button1 AS QButton
Caption = "Hello world!"
END CREATE
END CREATE
CREATE Panel1 AS QPanel
Top = 40
Left = 5
Width = Tab.ClientWidth - 10
Height = Tab.ClientHeight - 50
Caption = "Panel 2"
BevelInner = bvLowered
Visible = False
END CREATE
CREATE Panel2 AS QPanel
Top = 40
Left = 5
Width = Tab.ClientWidth - 10
Height = Tab.ClientHeight - 50
Caption = "Panel 3"
BevelInner = bvLowered
Visible = False
END CREATE
CREATE Panel3 AS QPanel
Top = 40
Left = 5
Width = Tab.ClientWidth - 10
Height = Tab.ClientHeight - 50
Caption = "Panel 4"
BevelInner = bvLowered
Visible = False
END CREATE
END CREATE
END CREATE
SUB TabChange
SELECT CASE Tab.TabIndex
CASE 0
Panel0.Visible = True
Panel1.Visible = False
Panel2.Visible = False
Panel3.Visible = False
CASE 1
Panel1.Visible = True
Panel0.Visible = False
Panel2.Visible = False
Panel3.Visible = False
CASE 2
Panel2.Visible = True
Panel1.Visible = False
Panel0.Visible = False
Panel3.Visible = False
CASE 3
Panel3.Visible = True
Panel1.Visible = False
Panel2.Visible = False
Panel0.Visible = False
END SELECT
END SUB
MainForm.ShowModal