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.

flags$

Tab control flags, as follows:

 

Flag

Description

 

$0001$

Sets the control to be initially disabled.

 

$0010$

Sets the control to be initially invisible.

 

$0800$

Draws a recessed client edge around the control.

 

$1000$

Draws a raised edge around the control.

styles

Tab style flags, as follows:

 

$00000001$

Displays tabs as buttons but does not draw a border around the display area.

 

$00000002$

Adjusts all tabs to the same width but cannot be combined with $00000100$.

 

$00000004$

Prevents the tab control from receiving input focus.

 

$00000008$

Sets tabs to receive focus when clicked.

 

$00000010$

Forces icons to the left margin and must be used with $00000002$.

 

$00000020$

Sets the label immediately to the right of the icon instead of centering it. Must be used with $00000002$ and includes $00000010$.

 

$00000040$

Allows multiple tab rows.

 

$00000080$

Does not extend each row of tabs to fill the entire width of the control. This is the default style.

 

$00000100$

Extends the width of each tab to fill the entire width of the tab control and is ignored, unless $00000040$ is also specified.

 

$00000200$

Retains the image list when the control is destroyed to allow it to be assigned to multiple tab controls.

 

$00000400$

Causes all tabs to appear on one line. Use scroll to see more tabs, if necessary. This is the default line style.

 

$00000800$

Displays tabs and draws a border around the display area. This is the default style.

 

$00001000$

Prevents a tab's associated control or child window from being automatically displayed when the tab is selected. It also prevents a tab's managed controls or child windows from being automatically resized when the tab is resized. By default, a tab will automatically display an associated control or child window when it is selected and will automatically resize its managed controls or child windows when it is resized.

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)

 

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.

 

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.

 

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

See Also

Mnemonics - Alphabetical Listing

Mnemonics - Group Listing



______________________________________________________________________________________

Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.