NewTabs |
Description
Adds a tab control to a form |
Syntax
[Set oCtl =] oFrm. NewTabs |
( Name, Left, Top, Width, Height, [Container] ) |
Parameters
Part |
Description |
Set oCtl = |
(optional) Store a reference to the new control in the variable oCtl. This variable can be used to access the control's properties and methods. |
oFrm |
A reference to a form object (see the NewForm method) |
Name |
The name of the control. It must be unique within the form and may not be empty or start with an asterisk (*) |
Left |
See the list of properties below |
Top |
See the list of properties below |
Width |
See the list of properties below |
Height |
See the list of properties below |
Container |
(optional) The name of an existing control that will act as container for the tab control. If unspecified or an empty string, the Form itself will be the container. Please note that the Left and Top properties are relative to the container's left and top edges |
Properties and Methods
Property |
Description |
|
BackColor |
Background color (use the RGB function to assign a color value) |
|
Enabled |
(boolean) Determines if the control can respond to user-generated events |
|
Fontname |
The font used to display text. The default is determined by the system. Check the glossary for an explanation about setting font properties. |
|
Fontsize |
The size of the font in points. The maximum is 2160 points. |
|
Fontbold |
(boolean) Enable or disable the bold style of a font |
|
Fontitalic |
(boolean) Enable or disable the italic style of a font |
|
Fontstrikethru |
(boolean) Enable or disable the |
|
Fontunderline |
(boolean) Enable or disable the underline style of a font |
|
ForeColor |
Foreground color (use the RGB function to assign a color value) |
|
Height |
The height of the control in twips |
|
Left |
The distance from the left edge of the specified container in twips |
|
Parent |
(read-only) Returns the parent form, object or collection. You can use the parent property to access the properties and methods of an object's parent |
|
Rows |
(read-only) Returns the total number of rows of tabs. You can use the Tabs and TabsPerRow properties to specify the number of rows |
|
ShowFocusRect |
(boolean) Returns or sets a value that determines if the focus rectangle is visible on a tab when it gets the focus |
|
Style |
Returns or sets the style of the tabs : |
|
0 |
(Default) The tabs that appear in the tabbed dialogs look like those in Microsoft Office for Microsoft Windows 3.1 applications. If you select this style, the active tab's font is bold |
|
1 |
The tabs that appear in the tabbed dialogs look like those in Microsoft Windows 95. When you select this setting, the TabMaxWidth property is ignored and the width of each tab adjusts to the length of the text in its caption. The font used to display text in the tab is not bold |
|
Tab |
Returns or sets the current tab. The tab moves to the front and becomes the active tab. New controls can only be placed on the active tab. |
|
TabCaption (tab) |
(string) Returns or sets the caption for an individual tab. You can specify an access key for the tab by including an ampersand sign (&) |
|
TabEnabled (tab) |
(boolean) Returns or sets a value that determines if the specified tab is available when clicked. When a tab is disabled, the text on the tab appears dimmed and the user cannot select that tab |
|
TabHeight |
Returns or sets the height of all tabs |
|
TabMaxWidth |
Returns or sets the maximum width of each tab. When the Style property is set to 0 and TabMaxWidth is set to 0, the tabs are sized automatically to fit evenly across the control (based on the TabsPerRow property). If the Style property is set to 1, TabMaxWidth is ignored. The width of each tab adjusts automatically to the length of the text in the TabCaption property |
|
TabOrientation |
Returns or sets the location of the tabs (if you are using TrueType fonts, the text is rotated when TabOrientation is set to 2 or 3) |
|
0 |
The tabs appear at the top of the control. |
|
1 |
The tabs appear at the bottom of the control. |
|
2 |
The tabs appear on the left side of the control. |
|
3 |
The tabs appear on the right side of the control. |
|
TabPicture (tab) |
Returns or sets a bitmap or icon to be displayed on the specified tab. You can set this property using the LoadPic function or the Picture property of another control or Form object |
|
Tabs |
Returns or sets the total number of tabs |
|
TabsPerRow |
Returns or sets the number of tabs for each row |
|
TabStop |
(boolean) Determines whether the TAB key can be used to move the focus |
|
TabVisible (tab) |
(boolean) Determines if the specified tab is visible or hidden |
|
Tag |
(reserved) Used internally to store the user-defined controlname |
|
ToolTipText |
Explanatory text that appears in a small rectangle below the object when you pause the mouse pointer (hover) over it for about one second |
|
Top |
The distance from the top edge of the specified container in twips |
|
Visible |
(boolean) Determines whether the control is visible or hidden |
|
Width |
The width of the control in twips |
|
Method |
Description |
|
Move |
Parameters: left [, top [, width [, height ]]] |
|
Only the left argument is required. However, to specify any other arguments, you must specify all arguments that appear in the syntax before the argument you want to specify. For example, you can't specify width without specifying left and top. Any trailing arguments that are unspecified remain unchanged |
||
Setfocus |
Moves the focus to the specified control |
Example
Option Explicit Set oDlg = Wscript.CreateObject("WshDialog.Kit", "oDlg_") 'Call BuildForm to build the form and store a reference in oFrm Set oFrm = BuildForm 'Show the form oFrm.Show vbModal '-------------------------------------------------------------------------------------------------- ' The BuildForm function builds the form and returns a reference to it '-------------------------------------------------------------------------------------------------- Function BuildForm Dim oFrm, oCtl, oTab, sInfo 'Add a form and store a reference to it in the variable oFrm Set oFrm = oDlg.NewForm("TabSample") 'Set the form's caption oFrm.Caption = "Testing the SSTab control" 'Create the tabs control with 3 tabs and no focus rectangles Set oTab = oFrm.NewTabs("TABS", 100, 200, 6000, 1700) oTab.Tabs = 3: oTab.ShowFocusRect = False 'Set each tab's caption oTab.TabCaption(0) = "&Boot Options" oTab.TabCaption(1) = "&System" oTab.TabCaption(2) = "&Windows" 'Activate tab 0 to add two checkboxes oTab.Tab = 0 oFrm.NewCheckBox "CBX1", 300, 600, 3000, 375, "Disable Bootmenu", 1, "TABS" oFrm.NewCheckBox "CBX2", 300, 1100, 3000, 375, "Disable Boot into GUI", 0, "TABS" 'Activate tab 1 to add two checkboxes oTab.Tab = 1 oFrm.NewCheckBox "CBX3", 300, 600, 3000, 375, "Enable Beep on Error", 1, "TABS" oFrm.NewCheckBox "CBX4", 300, 1100, 3000, 375, "No Autoplay Data CD", 0, "TABS" 'Activate tab 2 to add two checkboxes oTab.Tab = 2 oFrm.NewCheckBox "CBX5", 300, 600, 3000, 375, "Hide Windows Version", 0, "TABS" oFrm.NewCheckBox "CBX6", 300, 1100, 3000, 375, "No Arrow on Shortcut", 0, "TABS" 'Automatically size the form to the controls placed on it oFrm.AutoSize 'Show the form in the taskbar oFrm.TaskBar = True 'Enable event handling (callback) for this form oFrm.CallBack = True 'Return the form object Set BuildForm = oFrm End Function '-------------------------------------------------------------------------------------------------- ' oDlg_ClickHandler handles the events sent by the controls '-------------------------------------------------------------------------------------------------- Sub oDlg_ClickHandler(sForm, sControl) Dim oFrm, oCtl 'Get a reference to the form and the control that raised the event Set oFrm = oDlg.Frm(sForm) Set oCtl = oFrm.Ctl(sControl) 'Check which control caused the event Select Case UCase(sControl) Case "CBX1", "CBX2" 'Checkbox 1 or 2 on tab 0 was clicked MsgBox sControl & " was clicked on tab " & oFrm.Ctl("TABS").TabCaption(0) Case "CBX3", "CBX4" 'Checkbox 3 or 4 on tab 1 was clicked MsgBox sControl & " was clicked on tab " & oFrm.Ctl("TABS").TabCaption(1) Case "CBX5", "CBX6" 'Checkbox 5 or 6 on tab 2 was clicked MsgBox sControl & " was clicked on tab " & oFrm.Ctl("TABS").TabCaption(2) Case "*CLOSE" ‘The closebox was clicked. Dismiss the form (hide it) oFrm.Hide Case Else 'Ignore all other events. Do NOT use oFrm.Hide here, ‘or any event not handled above will dismiss the form End Select End Sub |