TABCTRL Mnemonic - Create a Tab Control
Syntax
'TABCTRL'(id,x,y,w,h,flags${,styles${,tabdesc${,imagelist}}})
Description
For BBj-specific information, see TABCTRL
Mnemonic - Create a Tab Control - BBj.
The 'TABCTRL' mnemonic creates a tab control in the main window of the
current context. The tab control client area displays the contents of
a control or child window. Like group boxes, tab controls provide a bounding
area for the controls in the area.
Parameter | Description | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | Control ID number. It must be an integer between 1 and 32767 and be unique within a given top-level window. | ||||||||||||||||||||||||||||
x | Horizontal position of the upper-left corner of the tab control. | ||||||||||||||||||||||||||||
y | Vertical position of the upper-left corner of the tab control. | ||||||||||||||||||||||||||||
w | Width of the tab control. | ||||||||||||||||||||||||||||
h | Height of the tab control. | ||||||||||||||||||||||||||||
title | Has no effect and can contain a null value. | ||||||||||||||||||||||||||||
flags | Tab control flags,
as follows:
|
||||||||||||||||||||||||||||
styles | Tab style flags, as follows:
|
||||||||||||||||||||||||||||
tabdesc$ |
Tab descriptor. A tab descriptor must exist for each tab item on the tab control and must reference the index of the image to be displayed on the tab. The table below identifies the tab descriptor fields. The string is identical to the TABDES$ string defined in SENDMSG() TABCTRL Function 27: imgidx:i(2),id:I(2),text:c(1*=0) |
||||||||||||||||||||||||||||
imgidx | The imgidx field is a binary string that contains the index of the image list being used by the tab control. It has a relative offset of 1 and a length of 2. A value of -1, $FFFF$, indicates that the image is to be displayed on the tab. If no image list is specified during creation, this field is ignored. | ||||||||||||||||||||||||||||
id | The id field is a binary string containing the ID of the child window or control to be displayed when the user selects the tab item. It has a relative offset of 3 and a length of 2. A value of -1, $FFFF$, indicates that no child window or control will automatically be displayed. The control or child window does not need to exist at the time of creation, but it must exist when user selects the tab, or a blank client area will be shown. | ||||||||||||||||||||||||||||
text | The text field is a null-terminated string that defines the text to be displayed on the tab item. It has a relative offset of 5 and a variable length. | ||||||||||||||||||||||||||||
imagelist | Imagelist ID. If the specified bitmap cannot be located, an !ERROR=12 is generated. |
Managing Tab Controls with TABCTRL SENDMSG() Functions
To manage a tab control after its creation, use TABCTRL SENDMSG() functions.
Displaying Graphics on Tabs
To display graphics on tabs, enter an image list ID in the imagelist parameter. See the 'IMAGELIST' mnemonic for additional information.
Example
The following program creates a window that contains three edit controls that are initially invisible and creates the tab description string used to create the tab control. The three created tabs are tied to control IDs 101, 201, and 301 respectively, but do not contain images. The program creates the tab control as control ID 601 with a 3D client edge, auto management, and the tab description string created earlier. The program then enters a REPEAT/UNTIL loop waiting for the Close Box Event to terminate the program.
begin
sysgui=unt; open (sysgui)"X0"
dim event$:tmpl(sysgui)
print (sysgui)'window'(20,20,500,300,"Tab Window",$0002$,$$)
print (sysgui)'edit'(101,30,55,240,0,"Edit control on Tab 1",$0810$)
print (sysgui)'edit'(201,30,80,240,0,"Edit control on Tab 2",$0810$)
print (sysgui)'edit'(301,30,105,240,0,"Edit control on Tab 3",$0810$)
tabdesc$=bin(-1,2)+bin(101,2)+"Tab 1"+$00$
: +bin(-1,2)+bin(201,2)+"Tab 2"+$00$
: +bin(-1,2)+bin(301,2)+"Tab 3"+$00$
print (sysgui)'tabctrl'(601,10,10,480,280,$0800$,$100000$,tabdesc$)
repeat
read record (sysgui,siz=len(event$))event$
until event.code$="X"
end