Tab control

A Tab control contains tab pages, which are user objects that contain controls. Tab pages can be defined within the Tab control or they can be defined in the User Object painter and inserted into the Tab control.

Each tab page can have its own label, picture, and background color.

All tab pages share the same font settings.

Tab Position controls where the tabs on the tab pages are displayed. Tabs can be displayed on any one of the four edges of the Tab control. They can also be displayed on opposite edges with the tabs before or after the selected tab jumping to the other edge.

Properties

Tab property

Datatype

Description

AccessibleDescription

String

A description of the control and/or its purpose for use by accessibility tools such as readers for visually impaired users.

AccessibleName

String

A label that briefly describes the control, such as the text in a button or the name of a menu item.

AccessibleRole

AccessibleRole (enumerated)

Describes what kind of user interface element the control is.

Alignment

Alignment (enumerated)

Specifies the alignment of the text labeling all the tabs. Values are:

Left!

Center!

Right!

BackColor

Long

Specifies the numeric value of the background color: -2 to 16,777,215. For more information about color, see the section called “RGB” in PowerScript Reference.

BoldSelectedText

Boolean

Specifies whether the text for the selected tab is bold. Values are:

TRUE -- The text on the selected tab is bold.

FALSE -- The text on the selected tab has the same setting as the other tabs.

BringToTop

Boolean

Specifies whether PowerBuilder moves the control to the top of the front-to-back order in the window. Values are:

TRUE -- Moves to the top.

FALSE -- Does not move to the top.

ClassDefinition

PowerObject

An object of type PowerObject containing information about the class definition of the object or control.

CreateOnDemand

Boolean

Specifies whether PowerBuilder creates graphical representations of controls on all tab pages when the Tab control is created. Values are:

TRUE  -- Graphical representations of tab pages are not created until the tab page is selected.

FALSE -- (Default) Graphical representations of tab pages are created when the Tab control is created.

Control[ ]

UserObject

Specifies the array of tab pages within the Tab control.

DragAuto

Boolean

Specifies whether PowerBuilder puts the control automatically into Drag mode. Values are:

TRUE  -- When the control is clicked, the control is automatically in Drag mode.

FALSE -- When the control is clicked, the control is not automatically in Drag mode. You have to manually put the control into Drag mode by using the Drag function.

DragIcon

String

Specifies the name of the stock icon or the file containing the icon you want to display when the user drags the control (the ICO file). The default icon is a box the size of the control.

When the user drags the control, the icon displays when the control is over an area in which the control can be dropped (a valid drop area). When the control is over an area that is not a valid drop area, the No-Drop icon displays.

Enabled

Boolean

Specifies whether the control is enabled (can be selected). Values are:

TRUE -- Can be selected.

FALSE -- Cannot be selected.

FaceName

String

Specifies the name of the typeface used for the text labels on tabs (for example, Arial or Courier). Only TrueType fonts display correctly on vertical tabs.

FixedWidth

Boolean

Specifies whether tabs have a fixed width, meaning they do not shrink to the length of their text labels. Values are:

TRUE  -- Tab width is fixed; the width is determined by the longest text label.

FALSE -- Tab width adjusts to the length of the text labels.

FocusOnButtonDown

Boolean

Specifies whether each tab gets focus when the user clicks on it. Values are:

TRUE  -- The tab the user clicks on gets focus; a dotted rectangle marks the tab.

FALSE -- The tab does not get focus.

In either case, the selected tab page comes to the front.

The dotted focus rectangle appears on the tab when the user clicks on it a second and subsequent times even if this property is set to false.

FontCharSet

FontCharSet (enumerated)

Specifies the character set for the text labels on the tabs. For a complete list of possible values, see the list of properties for the FontCharSet variable on the Enumerated tab page of the Browser.

FontFamily

FontFamily (enumerated)

Specifies the font family (type style) for the text labels on the tabs. Values are:

AnyFont!

Decorative!

Modern!

Roman!

Script!

Swiss!

FontPitch

FontPitch (enumerated)

Specifies the pitch (spacing) of the font for text labels on the tabs. Values are:

Default!

Fixed!

Variable!

Height

Integer

Specifies the height of the control, in PowerBuilder units.

Italic

Boolean

Specifies whether the text on the tabs is italic. Values are:

TRUE -- Text labels are italic.

FALSE -- Text labels are not italic.

Multiline

Boolean

Specifies whether the tabs can appear in more than one row. Values are:

TRUE  -- If there is not room for all the tabs in a single row, the tabs are arranged in multiple rows.

FALSE -- If there is not room for all the tabs in a single row, a dual arrow control displays to allow the user to scroll to tabs that do not fit.

PerpendicularText

Boolean

Specifies whether the tab labels are drawn perpendicular to the tab page. Values are:

TRUE  -- Text is perpendicular to the edge of the tab page, resulting in narrower tabs.

FALSE -- Text runs along the edge of the tab page, resulting in wider tabs.

PictureOnRight

Boolean

Specifies whether a picture that is part of the tab label is to the right or left of the text. Values are:

TRUE -- The picture is on the right.

FALSE -- The picture is on the left.

Pointer

String

Specifies the name of the stock pointer or the file containing the pointer used for the control.

PowerTips

Boolean

Specifies whether PowerTipText for a tab page is displayed as a PowerTip (a pop-up label for the tab) when the mouse pointer pauses over the tab. PowerTips are useful if the tabs are labeled with pictures. Values are:

TRUE  -- PowerTipText, if any, displays as a pop-up label for each tab.

FALSE -- No PowerTips are displayed.

RaggedRight

Boolean

Specifies whether tabs are stretched so that they fill space along the edge of the control. Values are:

TRUE  -- Tabs remain the size determined by their label text and the FixedWidth property.

FALSE -- Tabs are stretched to fill the edge.

SelectedTab

Integer

Specifies the index number of the selected tab. The default value is 1, and the integer must be in the range 1 to N, where N is the number of tab pages.

ShowPicture

Boolean

Specifies whether the picture selected for each tab is displayed. Values are:

TRUE -- The picture for each tab, if any, is displayed.

FALSE -- No pictures are displayed.

ShowText

Boolean

Specifies whether the text specified for each tab label is displayed. Values are:

TRUE -- The text for each tab is displayed.

FALSE -- The text for each tab is not displayed.

TabOrder

Integer

Specifies the tab value of the control within the window (0 means the user cannot tab to the control).

TabPosition

TabPosition (enumerated)

Specifies where the tabs appear around the Tab control. Values are:

  • TabsOnBottom! -- Tabs are at the bottom.

  • TabsOnBottomAndTop! -- Tabs before the selected tab are on top; the selected tab itself and tabs after it are on the bottom.

  • TabsOnLeft! -- Tabs are on the left.

  • TabsOnLeftAndRight! -- Tabs before the selected tab and the selected tab itself are on the left; tabs after the selected tab are on the right.

  • TabsOnRight! -- Tabs are on the right.

  • TabsOnRightAndLeft! -- Tabs before the selected tab are on the left; the selected tab and tabs after it are on the right.

  • TabsOnTop! -- Tabs are on top.

  • TabsOnTopAndBottom! -- Tabs before the selected tab and the selected tab itself are on top; tabs after the selected tab are on the bottom.

Tag

String

Specifies the tag value assigned to the control.

TextSize

Integer

Specifies the size of the text in the control, in points. For backward compatibility, the size is stored as a negative number; for example, 10-point text size is stored as -10.

Underline

Boolean

Specifies whether the text on the tabs is underlined. Values are:

TRUE -- Text labels are underlined.

FALSE -- Text labels are not underlined.

Visible

Boolean

Specifies whether the control is visible. Values are:

TRUE -- Is visible.

FALSE -- Is not visible.

Weight

Integer

Specifies the stroke weight of the text in the control; for example, 400 for normal or 700 for bold.

Width

Integer

Specifies the width of the control, in PowerBuilder units.

X

Integer

Specifies the X position (the distance from the left edge of the window), in PowerBuilder units.

Y

Integer

Specifies the Y position (the distance from the top of the window), in PowerBuilder units.


Events

Tab Event

Occurs

Clicked in PowerScript Reference

When the user clicks in the Tab control, except in the display area of the tab page. For the tab page, the Clicked event (pbm_bnclicked) for the user object is triggered instead.

Constructor in PowerScript Reference

When the object is created, immediately before the Open event occurs in the window.

Destructor in PowerScript Reference

When the object is destroyed, immediately after the Close event occurs in the window.

DoubleClicked in PowerScript Reference

When the user double-clicks in the Tab control, except in the display area of the tab page. For the tab page, the DoubleClicked event (pbm_bndoubleclicked) for the user object is triggered instead.

DragDrop in PowerScript Reference

When a dragged control is dropped in the tab area of the control.

DragEnter in PowerScript Reference

When a dragged control enters the control, including entering the narrow border around the display area.

DragLeave in PowerScript Reference

When a dragged control leaves the control, including leaving by crossing into the tab page display area.

DragWithin in PowerScript Reference

When a dragged control is within the control, but not within the tab page display area.

GetFocus in PowerScript Reference

Just before the control receives focus (before it is selected and becomes active).

Help in PowerScript Reference

When the user presses the F1 key or drags the context help button (question mark) from the title bar to a menu item or control.

Key in PowerScript Reference

When the user presses a key.

LoseFocus in PowerScript Reference

When the control loses focus (becomes inactive).

Other in PowerScript Reference

When a Windows message occurs that is not a PowerBuilder event.

RightClicked in PowerScript Reference

When the user clicks with the right mouse button in the Tab control, except in the display area of the tab page. If the user right-clicks on the tab page, the controls or user objects on the tab page get an RButtonDown event.

RightDoubleClicked in PowerScript Reference

When the user double-clicks with the right mouse button in the Tab control, except in the display area of the tab page. For the tab page, the RightDoubleClicked event (pbm_rbuttondblclk) for the user object is triggered instead.

SelectionChanged in PowerScript Reference

Just after the selection changes to another tab. SelectionChanged is triggered when the tab is created and the initial selection is established.

SelectionChanging in PowerScript Reference

Just before the selection changes to another tab. To prevent the selection from changing, return 1 in the event script. SelectionChanging is triggered when the tab is created and the initial selection is established.


Functions

Tab function

Datatype returned

Description

ClassName in PowerScript Reference

String

Returns the name assigned to the control.

CloseTab in PowerScript Reference

Integer

Closes a tab page that was opened with the OpenTab function.

Drag in PowerScript Reference

Integer

Starts or ends dragging of the control.

GetContextService in PowerScript Reference

Integer

Creates a reference to a context-specific instance of the specified service.

GetParent in PowerScript Reference

PowerObject

Returns a reference to the parent of the Tab control.

Hide in PowerScript Reference

Integer

Makes the control invisible.

Move in PowerScript Reference

Integer

Moves the control to a specified location.

MoveTab in PowerScript Reference

Integer

Moves a tab to a new position in the order of tabs.

OpenTab in PowerScript Reference

Integer

Opens the specified user object as a tab page, making its properties available to scripts.

OpenTabWithParm in PowerScript Reference

Integer

Opens the user object as a tab page, making its properties available to scripts, and stores a parameter in the Message object.

PointerX in PowerScript Reference

Integer

Returns the distance of the pointer from the left edge of the control.

PointerY in PowerScript Reference

Integer

Returns the distance of the pointer from the top of the control.

PostEvent in PowerScript Reference

Integer

Adds the specified event to the end of the event queue for the specified object.

Print in PowerScript Reference

Integer

Prints the contents of the control. You can specify a range of pages and other settings.

Resize in PowerScript Reference

Integer

Changes the size of the tab page to the size specified in the width and height arguments.

SelectTab in PowerScript Reference

Integer

Selects a tab page.

SetFocus in PowerScript Reference

Integer

Sets focus to the Tab control.

SetPosition in PowerScript Reference

Integer

Specifies the control's position in the front-to-back order within the window.

SetRedraw in PowerScript Reference

Integer

Controls automatic redrawing of the control.

Show in PowerScript Reference

Integer

Makes the control visible.

TabPostEvent in PowerScript Reference

Integer

Adds an event to the end of the message queues for each of the tab pages.

TabTriggerEvent in PowerScript Reference

Integer

Sends an event to every tab page and, for each page, executes the script associated with the event.

TriggerEvent in PowerScript Reference

Integer

Triggers a specified event in the control and executes the script for the event.

TypeOf in PowerScript Reference

Object

Returns the type of the control.