Chapter 27. TabControl Class

Table of Contents
Insert
Modify
AddSequence
AddFullSeq
Items
Rows
ItemInfo
Delete
DeleteAll
Last
Selected
SelectedIndex
Select
SelectIndex
Focus
Focused
SetImages
RemoveImages
SetPadding
SetSize
PosRectangle
AdjustToRectangle
RequiredWindowSize

A tab control can be compared to a divider in a notebook or a label in a file cabinet. By using a tab control, an application can define several pages for the same area of a dialog or dialog control. Each page consists of a set of information or a group of controls that the application displays when the user selects the corresponding tab.

A special type of tab control displays tabs that look like buttons. Clicking a button immediately performs a command instead of displaying a page.

You can apply specific characteristics to tab controls by specifying tab control styles. For example, you can specify the alignment and general appearance of the tabs in a tab control.

By default, a tab control displays only one row of tabs. If not all tabs can be shown at once, the tab control displays an up-and-down control so that the user can scroll to view additional tabs.

Refer to PROPDEMO.REX in the OODIALOG\SAMPLES directory for an example.

The TabControl class sends notification messages to notify about the event. For information about notification messages, refer to ConnectListNotify.

Requires:

The TabControl class requires the class definition file oodwin32.cls:

::requires "oodwin32.cls"

Methods:

Instances of the TabControl class implement the methods listed in the TabControl Instance Methods table.

Table 27-1. TabControl Instance Methods

Method......on page
AddFullSeqAddFullSeq
AddSequenceAddSequence
AdjustToRectangleAdjustToRectangle
DeleteDelete
DeleteAllDeleteAll
FocusFocus
FocusedFocused
InsertInsert
ItemInfoItemInfo
ItemsItems
LastLast
ModifyModify
PosRectanglePosRectangle
RemoveImagesRemoveImages
RequiredWindowSizeRequiredWindowSize
RowsRows
SelectSelect
SelectIndexSelectIndex
SelectedSelected
SelectedIndexSelectedIndex
SetImagesSetImages
SetPaddingSetPadding
SetSizeSetSize

Insert

>>-aTabControl~Insert(--+-----+--,--text--,--icon--,--numValue--)-><
                        +-tab-+


The Insert method inserts a new tab in a tab control.

Arguments:

The arguments are:

tab

The number of the tab. If you omit this argument, the number of the last tab is increased by 1, starting with 0.

text

The label text for the inserted tab.

icon

The index of the icon in the image list of the tab control, set with the SetImages method (see SetImages).

numValue

An integer value stored together with the tab to save information.

Return value:

The number of the new tab, or -1 for all other cases.

Example:

The following example inserts three tabs in a tab control with the specified text and a specific item:

::method InitDialog
  InitDlgRet = self~InitDialog:super
  curTab = self~GetTabControl("ID_TAB")
  if curTab \= .Nil then do
    curTab~SetImages("oodtab.BMP",16,16)
    curTab~Insert(,"First Tab",0)
    curTab~Insert(,"Second Tab",1)
    curTab~Insert(,"Third Tab",2)
  end
return InitDlgRet