Skip to main content

TabControl_Operation

TabControl [/Z] ctrlName [ keyword = value [, keyword = value ...] ]

The TabControl operation creates tab panels for controls.

For information about the state or status of the control, use the ControlInfo operation.

Parameters

ctrlName is the name of the TabControl to be created or changed.

The following keyword=value parameters are supported:

align=alignmentSets the alignment mode of the control. The alignment mode controls the interpretation of the leftOrRight parameter to the pos keyword. The align keyword was added in Igor Pro 8.00.
If alignment=0 (default), leftOrRight specifies the position of the left end of the control and the left end position remains fixed if the control size is changed.
If alignment=1, leftOrRight specifies the position of the right end of the control and the right end position remains fixed if the control size is changed.
appearance={kind [, platform ]}
Sets the appearance of the control. platform is optional. Both parameters are names, not strings.
kind can be one of default, native, or os9.
platform can be one of Mac, Win, or All.
See DefaultGUIControls TabControl Background Details for how enclosed controls are affected by native TabControl appearance.
See Button for more appearance details.
disable=dSets user editability of the control.
d =0:Normal.
d =1:Hide.
d =2:Draw in gray state; disable control action.
fColor=(r,g,b[,a])Sets the initial color of the tab labels. r, g, b, and a specify the the color and optional opacity as RGBA Values. Use of transparency is discouraged. The default is opaque black.
To further change the color of the tab labels text, use escape sequences in the text specified by the tabLabel keyword.
focusRing=frEnables or disables the drawing of a rectangle indicating keyboard focus:
fr=0:Focus rectangle will not be drawn.
fr=1:Focus rectangle will be drawn (default).
font= "fontName"Sets font for tabs.
fsize= sSets font size for tabs.
fstyle=fsfs is a bitwise parameter with each bit controlling one aspect of the font style as follows:
Bit 0:Bold
Bit 1:Italic
Bit 2:Underline
Bit 4:Strikethrough
See Setting Bit Parameters for details about bit settings.
guides={left, hcenter, right, top, vcenter, bottom}
Controls attachments of anchor points to layout guides. See Laying Out Controls in Guides Mode for detailed information and examples.
Each of left, hcenter, right, top, vcenter, bottom is replaced with the name of a layout guide of appropriate orientation. That is, left, hcenter, right indicate attachments to vertical guides, and top, vcenter, bottom indicate attachments to horizontal guides. Use the special name kwNone to represent an unattached anchor point.
An error results if you overconstrain a control's layout. Of the three horizontal or vertical anchor points, at most two may be attached to layout guides. Attaching one of the three causes a control to move as the layout guide moves. Attaching two causes a control to both move and resize. Because of limits on constraints, the name kwNone will appear at least twice.
Using kwNone for all anchor points results in completely detaching a control from the layout guides.
help={helpStr}Sets the help for the control.
helpStr is limited to 1970 bytes (255 in Igor Pro 8 and before).
You can insert a line break by putting "\r" in a quoted string.
labelBack=(r,g,b[,a]) or 0
Sets fill color for current tab and the interior. r, g, b, and a specify the the color and optional opacity as RGBA Values. The actual result may be platform dependent.
If not set, then interior is transparent and the current tab is filled with the window background, though this style is platform-dependent.
If an opaque fill color is used, drawing objects will not be seen because they will be covered up.
noprocSpecifies that no function is to run when tab is pressed.
pos={leftOrRight,top}Sets the position in control panel units of the top/left corner of the control if its alignment mode is 0 or the top/right corner of the control if its alignment mode is 1. See the align keyword above for details.
pos+={dx,dy}Offsets the position of the control in control panel units.
proc=procNameSpecifies the function to run when the tab is pressed. It is the job of your function to hide and show other controls as desired. The TabControl does not do this automatically.
rename=newNameGives the control a new name.
size={width,height}Sets TabControl size in control panel units.
tabLabel(n)=lblSets nth tab label to lbl.
Set the label of the last tab to "" to remove the last tab.
Using escape codes you can change the font, size, style and color of the label. See Annotation Escape Codes for details.
userdata(UDName)=UDStr
Sets the unnamed user data to UDStr. Use the optional (UDName) to specify a named user data to create.
userdata(UDName)+=UDStr
Appends UDStr to the current unnamed user data. Use the optional (UDName) to append to the named user data.
value=vSets current tab number. Tabs count from 0.
win=winNameSpecifies which window or subwindow contains the named control. If not given, then the top-most graph or panel window or subwindow is assumed.
When identifying a subwindow with winName, see Subwindow Syntax for details on forming the window hierarchy.

Flags

/ZNo error reporting.

Details

The target window must be a graph or panel.

Tab Control Action Procedure

The action procedure for a TabControl takes a predefined WMTabControlAction structure as a parameter to the function:

Function ActionProcName(TC_Struct) : TabControl
STRUCT WMTabControlAction &TC_Struct
...
return 0
End

The ": TabControl" designation tells Igor to include this procedure in the Procedure pop-up menu in the Tab Control dialog.

See WMTabControlAction for details on the WMTabControlAction structure.

Although the return value is not currently used, action procedures should always return zero.

When clicking a TabControl with the selector arrow, click in the title region. The control is not selected if you click in the body. This is to make it easier to select controls in the body rather than the TabControl itself.

Example

Designing a TabControl with all the accompanying interior controls can be somewhat difficult. Here is a suggested technique:

First, create and set the size and label for one tab. Then create the various controls for this first tab. Before starting on the second tab, create the TabControl's procedure so that it can be used to hide the first set of controls. Then add the second tab, click it to run your procedure and start adding controls for this new tab. When done, update your procedure so the new controls are hidden when you start on the third tab.

Here is an example:

  1. Create a panel and a TabControl:
NewPanel /W=(150,50,478,250)
ShowTools
TabControl MyTabControl,pos={29,38},size={241,142},tabLabel(0)="First Tab",value= 0
  1. Add a few controls to the interior of the TabControl:
Button button0,pos={52,72},size={80,20},title="First"
CheckBox check0,pos={52,105},size={102,15},title="Check first",value= 0
  1. Write an action procedure:
Function TabActionProc(tc) : TabControl
STRUCT WMTabControlAction& tc

switch (tc.eventCode)
case 2: // Mouse up
Button button0, disable=(tc.tab!=0)
CheckBox check0, disable=(tc.tab!=0)
break
endswitch

return 0
End
  1. Set the action procedure and add a new tab:
TabControl MyTabControl,proc=TabActionProc,tabLabel(1)="Second Tab"
  1. Click the second tab, which hides the first tab's controls, and then add new controls like this:
Button button1,pos={58,73},size={80,20},title="Second"
CheckBox check1,pos={60,105},size={114,15},title="Check second",value= 0
  1. Finally, change the action procedure by adding these lines at the end:
Button button1,disable= (tc.tab!=1)
CheckBox check1,disable= (tc.tab!=1)

See Also

Controls and Control Panels for details about control panels and controls.

Control Panel Units for a discussion of the units used for controls.

The ControlInfo operation for information about the control.

The GetUserData function for retrieving named user data.

The ModifyControl and ModifyControlList operations.