1iwidgets::tabset  −  create  and  manipulate tabs as as set iwid‐

gets::tabset pathName ?options? itk::Widget <‐ iwidgets::Tabset

background font selectBackground cursor

foreground selectForeground disabledForeground height

width

6See the "options" manual entry for details on  the  standard  op‐
7tions.
8Name:           angle
9Class:          Angle
10Command‐Line Switch:           ‐angle
11Specifes the angle of slope from the inner edge to the outer edge
12of the tab. An angle of 0 specifies square tabs. Valid ranges are
130  to 45 degrees inclusive. Default is 15 degrees. If tabPos is e
14or w, this option is ignored.
15Name:           backdrop
16Class:          Backdrop
17Command‐Line Switch:           ‐backdrop
18Specifies a background color to use when filling in the area  be‐
19hind the tabs.
20Name:           bevelAmount
21Class:          BevelAmount
22Command‐Line Switch:           ‐bevelamount
23Specifes  the size of tab corners. A value of 0 with angle set to
240 results in square tabs. A bevelAmount of 4, means that the  tab
25will  be  drawn with angled corners that cut in 4 pixels from the
26edge of the tab. The default is 0.
27Name:           command
28Class:          Command
29Command‐Line Switch:           ‐command
30Specifes the prefix of a Tcl command to invoke to change the view in the
31widget associated with the tabset. When a user selects a tab, a Tcl command
32is invoked. The actual command consists of this option followed by a space
33and a number. The number is the numerical index of the tab that has been
34selected.
35Name:           equalTabs
36Class:          EqualTabs
37Command‐Line Switch:           ‐equaltabs
38Specifies whether to force tabs to be equal sized or not. A value
39of  true means constrain tabs to be equal sized. A value of false
40allows each tab to size based on the text label size.  The  value
41may have any of the forms accepted by the Tcl_GetBoolean, such as

true, false, 0, 1, yes, or no. For horizontally positioned tabs

43(tabPos is either s or n), true forces all tabs to be equal width
44(the width being equal to the longest label plus any padX  speci‐
45fied). Horizontal tabs are always equal in height.  For vertical‐
46ly positioned tabs (tabPos is either w or  e),  true  forces  all
47tabs  to be equal height (the height being equal to the height of
48the label with the largest font). Vertically  oriented  tabs  are
49always equal in width.
50Name:           gap
51Class:          Gap
52Command‐Line Switch:           ‐gap
53Specifies  the  amount  of pixel space to place between each tab.
54Value may be any pixel offset value. In addition, a special  key‐
55word overlap can be used as the value to achieve a standard over‐
56lap of tabs. This value may have any of the forms  acceptable  to

Tk_GetPixels.

58Name:           margin
59Class:          Margin
60Command‐Line Switch:           ‐margin
61Specifies  the  amount of space to place between the outside edge
62of the tabset and the outside edge of its tabs. If tabPos  is  s,
63this is the amount of space between the bottom edge of the tabset
64and the bottom edge of the set of tabs. If tabPos is n,  this  is
65the  amount  of  space between the top edge of the tabset and the
66top edge of the set of tabs. If tabPos is e, this is  the  amount
67of  space between the right edge of the tabset and the right edge
68of the set of tabs.  If tabPos is w, this is the amount of  space
69between  the left edge of the tabset and the left edge of the set
70of tabs. This value may have  any  of  the  forms  acceptable  to

Tk_GetPixels.

72Name:           padX
73Class:          PadX
74Command‐Line Switch:           ‐padx
75Specifies a non‐negative value indicating how much extra space to
76request for a tab around its label in the X‐direction. When  com‐
77puting  how large a window it needs, the tab will add this amount
78to the width it would normally need The tab will end up with  ex‐
79tra  internal space to the left and right of its text label. This
80value may have any of the forms acceptable to Tk_GetPixels.
81Name:           padY
82Class:          PadY
83Command‐Line Switch:           ‐pady
84Specifies a non‐negative value indicating how much extra space to
85request  for a tab around its label in the Y‐direction. When com‐
86puting how large a window it needs, the tab will add this  amount
87to the height it would normally need The tab will end up with ex‐
88tra internal space to the top and bottom of its text label.  This
89value may have any of the forms acceptable to Tk_GetPixels.
90Name:           raiseSelect
91Class:          RaiseSelect
92Command‐Line Switch:           ‐raiseselect
93Specifes whether to slightly raise the selected tab from the rest
94of the tabs. The selected tab is drawn 2  pixels  closer  to  the
95outside  edge  of the tabset than the unselected tabs. A value of
96true says to raise selected tabs, a value  of  false  turns  this
97off.  The  default  is false. The value may have any of the forms
98accepted by the Tcl_GetBoolean, such as true, false, 0,  1,  yes,
99or no.
100Name:           start
101Class:          Start
102Command‐Line Switch:           ‐start
103Specifies  the  amount  of space to place between the left or top
104edge of the tabset and the starting edge of its tabs.  For  hori‐
105zontally positioned tabs, this is the amount of space between the
106left edge of the tabset and the left edge of the first  tab.  For
107vertically  positioned  tabs, this is the amount of space between
108the top of the tabset and the top of the first  tab.  This  value
109may  change  if the user performs a MButton‐2 scroll on the tabs.
110This value may have any of the forms acceptable to Tk_GetPixels.
111Name:           state
112Class:          State
113Command‐Line Switch:           ‐state
114Sets the active state of the tabset. Specifying normal allows all
115tabs  to  be  selectable. Specifying disabled disables the tabset
116causing all tabs to be drawn in the disabledForeground color.
117Name:           tabBorders
118Class:          TabBorders
119Command‐Line Switch:           ‐tabborders
120Specifies whether to draw the borders of tabs that  are  not  se‐
121lected.  Specifying true (the default) draws these borders, spec‐
122ifying false draws only the border around the selected  tab.  The
123value  may  have any of the forms accepted by the Tcl_GetBoolean,
124such as true, false, 0, 1, yes, or no.
125Name:           tabPos
126Class:          TabPos
127Command‐Line Switch:           ‐tabpos
128Specifies the location of the set of tabs in relation to  another
129widget.  Must  be  n,  s, e, or w. Defaults to s. North tabs open
130downward, South tabs open upward. West tabs open  to  the  right,
131east tabs open to the left.  The iwidgets::tabset command creates
132a new window (given by the pathName argument) and makes it into a

tabset widget. Additional options, described above may be speci‐

134fied on the command line or in the option database  to  configure
135aspects  of  the  tabset  such as its colors, font, and text. The

iwidgets::tabset command returns its pathName argument. At the

137time this command is invoked, there must not exist a window named

pathName, but pathName’s parent must exist. A tabset is a widget

139that  contains  a set of Tab buttons. It displays these tabs in a
140row or column depending on it tabpos. When a tab is  clicked  on,
141it becomes the only tab in the tab set that is selected. All oth‐
142er tabs are deselected. The Tcl command  prefix  associated  with
143this  tab  (through  the command tab configure option) is invoked
144with the tab index number appended to its argument list. This al‐
145lows  the  tabset  to  control another widget such as a Notebook.
146Tabs are drawn to appear attached to another widget.  The  tabset
147draws an edge boundary along one of its edges. This edge is known
148as the attachment edge. This edge location is  dependent  on  the
149value of tabPos. For example, if tabPos is s, the attachment edge
150wil be on the top side of the tabset (in order to attach  to  the
151bottom or south side of its attached widget). The selected tab is
152draw with a 3d relief to appear above the other  tabs.  This  se‐
153lected  tab  "opens"  toward  attachment  edge.  Tabs can be con‐
154trolled in their location along the edges,  the  angle  that  tab
155sides  are drawn with, gap between tabs, starting margin of tabs,
156internal padding around labels in a tab, the font, and  its  text
157or  bitmap.   The iwidgets::tabset command creates a new Tcl com‐
158mand whose name is pathName. This command may be used  to  invoke
159various  operations  on  the widget. It has the following general
160form: pathName option ?arg arg ...?  option and the  args  deter‐
161mine  the exact behavior of the command.  Many of the widget com‐
162mands for a tabset take as one argument an indicator of which tab
163of  the tabset to operate on. These indicators are called indexes
164and may be specified in any of the following forms: number Speci‐
165fies the tab numerically, where 0 corresponds to the first tab in
166the tab set, 1 to the second, and so on.   select  Specifies  the
167currently  selected tab’s index. If no tab is currently selected,
168the value ‐1 is returned.  end Specifes the last tab in the  tab‐
169set’s index. If the tabset is empty this will return ‐1.  pattern
170If the index doesn’t satisfy any of the above  forms,  then  this
171form  is  used.  Pattern  is pattern‐matched against the label of
172each tab in the tabset, in order from the first to the last  tab,
173until a matching entry is found. The rules of Tcl_StringMatch are
174used.  The following commands are possible  for  tabset  widgets:

pathName add ?option value option value ...? Add a new tab at

176the end of the tabset. Returns the child site pathName. If  addi‐
177tional  arguments  are present, they specify any of the following
178options: ‐angle value Specifes the angle of slope from the  inner
179edge to the outer edge of the tab. An angle of 0 specifies square
180tabs. Valid ranges are 0 to 45 degrees inclusive. Default  is  15
181degrees.  If this option is specified as an empty string (the de‐
182fault), then the angle option for the  overall  tabset  is  used.

‐background value Specifies a background color to use for dis‐

184playing tabs when they are in their normal state (unselected). If
185this  option  is specified as an empty string (the default), then
186the background option for the overall tabset is used.   ‐bevelam‐

ount value Specifes the size of tab corners. A value of 0 with

188angle set to 0 results in square tabs. A bevelAmount of 4,  means
189that the tab will be drawn with angled corners that cut in 4 pix‐
190els from the edge of the tab. The default is 0. This is generally
191only  set  at  the tabset configuration level. Tabs normally will
192want to share the same bevelAmount.  ‐bitmap value If label is  a
193non‐empty  string, specifies a bitmap to display in the tab. Bit‐
194map may be of any of the forms accepted by  Tk_GetBitmap.   ‐dis‐

abledforeground value Specifies a foreground color to use for

196displaying tab labels when tabs are in their  disable  state.  If
197this  option  is specified as an empty string (the default), then
198the disabledforeground option for the  overall  tabset  is  used.

‐font value Specifies the font to use when drawing the label on a

200tab. If this option is specified as an empty string then the font
201option  for the overall tabset is used.  ‐foreground value Speci‐
202fies a foreground color to use for  displaying  tab  labels  when
203tabs  are  in  their  normal  unselected state. If this option is
204specified as an empty string (the default), then  the  foreground
205option  for the overall tabset is used.  ‐image value If label is
206a non‐empty string, specifies an image to display in the tab. Im‐
207age  must  have been created with the image create command. Typi‐
208cally, if the image option is specified then it  overrides  other
209options  that specify a bitmap or textual value to display in the
210widget; the image option may be reset to an empty string  to  re‐
211enable  a  bitmap or text display.  ‐label value Specifies a text
212string to be placed in the tabs label. If this value is set,  the
213bitmap option is overridden and this option is used instead. This
214label serves as an additional identifier used  to  reference  the
215tab.  This  label  may be used for the index value in widget com‐
216mands.  ‐selectbackground value Specifies a background  color  to
217use  for displaying the selected tab. If this option is specified
218as an empty string (the default), then the  selectBackground  op‐
219tion  for  the  overall  tabset is used.  ‐selectforeground value
220Specifies a foreground color to use for displaying  the  selected
221tab.  If  this  option  is  specified as an empty string (the de‐
222fault), then the selectForeground option for the  overall  tabset
223is  used.   ‐padx value Specifies a non‐negative value indicating
224how much extra space to request for a tab around its label in the
225X‐direction.  When computing how large a window it needs, the tab
226will add this amount to the width it would normally need The  tab
227will  end  up  with extra internal space to the left and right of
228its text label. This value may have any of the  forms  acceptable
229to  Tk_GetPixels.  If this option is specified as an empty string
230(the default), then the padX option for  the  overall  tabset  is
231used  ‐pady  value  Specifies a non‐negative value indicating how
232much extra space to request for a tab around its label in the  Y‐
233direction.  When  computing  how large a window it needs, the tab
234will add this amount to the height it would normally need The tab
235will  end  up  with extra internal space to the top and bottom of
236its text label. This value may have any of the  forms  acceptable
237to  Tk_GetPixels.  If this option is specified as an empty string
238(the default), then the padY option for  the  overall  tabset  is
239used  ‐state  value  Sets the state of the tab. Specifying normal
240allows this tab to be selectable.  Specifying  disabled  disables
241the  this  tab causing its tab label to be drawn in the disabled‐
242Foreground color. The tab will not respond to  events  until  the
243state  is set back to normal.  pathName configure ?option? ?value

option value ...? Query or modify the configuration options of

245the  widget. If no option is specified, returns a list describing
246all of the available options for pathName  (see  Tk_ConfigureInfo
247for  information on the format of this list). If option is speci‐
248fied with no value, then the command returns  a  list  describing
249the  one  named option (this list will be identical to the corre‐
250sponding sublist of the value returned if  no  option  is  speci‐
251fied).  If one or more option‐value pairs are specified, then the
252command modifies the given widget option(s)  to  have  the  given
253value(s);  in  this case the command returns an empty string. Op‐

tion may have any of the values accepted by the iwidgets::tabset

255command.  pathName delete index1 ?index2?  Delete all of the tabs
256between index1 and index2 inclusive.  If index2 is  omitted  then
257it  defaults  to index1. Returns an empty string.  pathName index

index Returns the numerical index corresponding to index. path‐

Name insert index ?option value option value ...? Insert a new

260tab in the tabset before the tab specified by  index.  The  addi‐
261tional arguments are the same as for the add command. Returns the
262tab’s pathName.  pathName next Advances the selected tab  to  the
263next  tab  (order  is determined by insertion order). If the cur‐
264rently selected tab is the last tab in the tabset, the  selection
265wraps around to the first tab. It behaves as if the user selected
266the next tab.  pathName tabconfigure index ?option? ?value?  This
267command  is  similar to the configure command, except that it ap‐
268plies to the options for an individual tab, whereas configure ap‐
269plies  to the options for the tabset as a whole. Options may have
270any of the values accepted by the add widget command. If  options
271are  specified,  options are modified as indicated in the command
272and the command returns an empty string. If no options are speci‐
273fied, returns a list describing the current options for tab index
274(see Tk_ConfigureInfo for  information  on  the  format  of  this
275list).   pathName prev Moves the selected tab to the previous tab
276(order is determined by insertion order). If  the  currently  se‐
277lected  tab  is  the first tab in the tabset, the selection wraps
278around to the last tab in the tabset. It behaves as if  the  user
279selected the previous tab.  pathName select index Selects the tab
280specified by index as the currently selected tab. It  behaves  as
281if the user selected the new tab.
282
283Following is an example that creates a tabset with two tabs and a
284list box that the tabset controls. In addition selecting an  item
285from the list also selects the corresponding tab.
286package require Iwidgets 4.0
287# Define a proc that knows how to select an item
288# from a list given an index from the tabset ‐command callback.
289  proc selectItem { item } {
290    .l selection clear [.l curselection]
291    .l selection set $item
292    .l see $item
293}
294# Define a proc that knows how to select a tab
295# given a y pixel coordinate from the list..
296  proc selectTab { y } {
297    set whichItem [.l nearest $y]
298    .ts select $whichItem
299}
300# Create a listbox with two items (one and two)
301# and bind button 1 press to the selectTab procedure.
302  listbox .l ‐selectmode single ‐exportselection false
303  .l insert end one
304  .l insert end two
305  .l selection set 0
306  pack .l
307  bind .l <ButtonPress‐1> { selectTab %y }
308# Create a tabset, set its ‐command to call selectItem
309# Add two labels to the tabset (one and two).
310  iwidgets::tabset .ts ‐command selectItem
311  .ts add ‐label 1
312  .ts add ‐label 2
313  .ts select 0
314  pack .ts ‐fill x ‐expand no
315Bill W. Scott tab tabset notebook tabnotebook
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
Impressum