


The TAB control combines a box with a tab for a control that looks like a file folder. The user may click on any tab to bring it forward. The user may also activate a particular tab by typing the key letter (the underscored letter in the tab's text) in conjunction with the "Alt" key. You may define a tab's key letter by placing an "&" in front of the intended key letter in the tab's text. This appears as an underscored letter when the tab is displayed. For example,
DISPLAY TAB-CONTROL, TAB-TO-ADD = ("Tab&1", "Tab&2")
Creates a control with two tabs. The first tab has a key letter of "1" and the second tab has a key letter of "2".
The program typically places different screen elements in the box depending on the tab selected.
When a user clicks on a tab, the program is informed of the new selection and the tab's appearance is updated. The behavioral distinction between tabs and push buttons is that a tab responds immediately when clicked, and a push button responds with the "clicked" event only when the mouse button is released. You may allow the user to activate the tabs with the keyboard by accepting the TAB control as any other control, but you need not do so if you wish to provide only a mouse interface. (For a detailed description of TAB control events, see Chapter 6, "Events Reference.")
Common Properties
TITLE
Tabs do not have titles.
VALUE
A TAB control has a numeric value, which represents the currently selected tab. Selecting a value outside of the range of existing tabs has an undefined effect.
SIZE
SIZE and LINES describe the area occupied by the TAB control, using the tab's font to determine the dimensions of the row and column. The area described includes the row(s) occupied by the tabs as well as the box.
COLOR
TAB controls are always displayed using the push button colors selected by the user in the Windows control panel.
STYLES
MULTILINE If the tabs do not all fit on one line, this style allows them to occupy as many lines as needed. If this style is not used, then the system adds a scroll bar so the user can scroll to the hidden tabs.
BUTTONS This style produces a TAB control with a different appearance. These tabs look like push buttons (the box is not shown), but they act much like a group of radio buttons.
FIXED-WIDTH This style causes each tab to occupy the same amount of space. Without this style, each tab is individually sized. Note that setting this style can cause an odd appearance on multiline tabs.
Special Properties
TAB-TO-ADD (alphanumeric) Assigning a value to this property adds a new tab to the control. The value is the text of the tab. You may add several tabs at once by using parentheses, as shown in the following example:
MODIFY TAB-1,
TAB-TO-ADD = ( "TAB 1", "TAB 2", "TAB 3" )
This example adds three tabs in the order listed. Inquiring from this property has no effect.
TAB-TO-DELETE (numeric) Assigning a non-zero value to this property removes the correspondingly numbered tab. Inquiring from this property has no effect.
RESET-TABS (numeric) Assigning a non-zero value to this property removes all existing tabs from the control. Inquiring from this property has no effect.
BITMAP-HANDLE (numeric) This property allows images from a bitmap file to be placed on individual tabs. The images are displayed before the text of each tab. Before a bitmap image can be used for a tab, you must load the bitmap file into memory by calling the library routine W$BITMAP with the WBITMAP-LOAD option. The routine returns a handle that is referred to by this property of the TAB-CONTROL.
The bitmap file loaded into memory is treated as a bitmap strip - a series of images of equal width that are laid out side-by-side in a single bitmap. The images are numbered sequentially starting at "1". By default, each tab in the control displays the image whose number is the same as the tab's ordinal number when the tab was defined. If you take the following code as an example,
MODIFY TAB-1,
TAB-TO-ADD = ( "TAB 1", "TAB 2", "TAB 3" )
then by default, TAB1 will show image "1", TAB2 will show image "2", and TAB3 will show image "3". You may change the default handling of the assignment of these images with the BITMAP-NUMBER property. See BITMAP-NUMBER and BITMAP-WIDTH for additional information. (create, modify, inquire)
BITMAP-WIDTH (numeric) This property sets the width of the images in the bitmap strip described by BITMAP-HANDLE. If this property is not set, the images default to 16-pixels wide. Set this property to match the actual width of the images that make up the bitmap strip to get the look that you desire for the tabs. (create, modify, inquire)
BITMAP-NUMBER (numeric) This property identifies which bitmap image will be displayed for each tab. To use this property, set the value of BITMAP-NUMBER to the number of the image in the bitmap strip.
This property is additive. The first time you set the BITMAP-NUMBER, the image identified with the bitmap number will be displayed on the first tab; the second time you set this property, the image identified will be displayed on the second tab, and so on. The additive behavior of this property may be overridden in one of three ways:
1) You may assign a value of "1" to this property.
2) You may empty the tab control through RESET-TABS.
3) You may specify a new list by keying in the bitmap numbers in parentheses as shown in the example below.
The following Screen Section entry creates a tab control with 3 tabs, and places image numbers 3, 5 and 7 on those tabs:
03 TAB-CONTROL
TAB-TO-ADD = ("Tab 1", "Tab 2", "Tab 3")
BITMAP-NUMBER = (3, 5, 7)
If you omit the BITMAP-NUMBER clause, the bitmap images are assigned in ordinal number by default. In other words, the following definition:
03 TAB-CONTROL
TAB-TO-ADD = ("Tab 1", "Tab 2", "Tab 3")
has the same meaning as:
03 TAB-CONTROL
TAB-TO-ADD = ("Tab 1", "Tab 2", Tab 3")
BITMAP-NUMBER = ( 1, 2, 3 )
When no value is set for this property, the default behavior is to automatically put bitmap number 1 on the first tab, bitmap number 2 on the second tab, and so on. (create, modify)
Events
CMD-HELP
CMD-TABCHANGED
MSG-VALIDATE