OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [itcl/] [iwidgets3.0.0/] [demos/] [html/] [tabset.n.html] - Blame information for rev 1770

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
<HTML>
2
<HEAD>
3
<TITLE>iwidgets2.2.0 User Commands - tabset</TITLE>
4
</HEAD>
5
<BODY BGCOLOR="#FFFFFF">
6
<H1>iwidgets2.2.0 User Commands - tabset</H1>
7
<HR>
8
<PRE>
9
 
10
</PRE>
11
<H2><HR ALIGN=LEFT WIDTH=70% SIZE=3></H2><PRE>
12
 
13
 
14
</PRE>
15
<H2>NAME</H2><PRE>
16
     tabset - create and manipulate tabs as as set
17
 
18
 
19
</PRE>
20
<H2>SYNOPSIS</H2><PRE>
21
     <STRONG>tabset</STRONG> <EM>pathName</EM> ?<EM>options</EM>?
22
 
23
 
24
</PRE>
25
<H2>INHERITANCE</H2><PRE>
26
     itk::Widget &lt;- tabset
27
 
28
 
29
</PRE>
30
<H2>STANDARD OPTIONS</H2><PRE>
31
     <STRONG>background</STRONG>      <STRONG>font</STRONG>           <STRONG>selectBackgroundcursor</STRONG>
32
     <STRONG>foreground</STRONG>      <STRONG>selectForeground</STRONG>               <STRONG>disabledForegroundheight</STRONG>
33
     <STRONG>width</STRONG>
34
 
35
     See the "options" manual entry for details on  the  standard
36
     options.
37
 
38
 
39
</PRE>
40
<H2>WIDGET-SPECIFIC OPTIONS</H2><PRE>
41
     Name:           <STRONG>angle</STRONG>
42
     Class:          <STRONG>Angle</STRONG>
43
     Command-Line Switch:           <STRONG>-angle</STRONG>
44
 
45
          Specifes the angle of slope from the inner edge to  the
46
          outer  edge  of the tab. An angle of 0 specifies square
47
          tabs. Valid ranges  are  0  to  45  degrees  inclusive.
48
          Default is 15 degrees. If tabPos is e or w, this option
49
          is ignored.
50
 
51
     Name:           <STRONG>backdrop</STRONG>
52
     Class:          <STRONG>Backdrop</STRONG>
53
     Command-Line Switch:           <STRONG>-backdrop</STRONG>
54
 
55
          Specifies a background color to use when filling in the
56
          area behind the tabs.
57
 
58
     Name:           <STRONG>bevelAmount</STRONG>
59
     Class:          <STRONG>BevelAmount</STRONG>
60
     Command-Line Switch:           <STRONG>-bevelamount</STRONG>
61
 
62
          Specifes the size of tab corners. A  value  of  0  with
63
          angle set to 0 results in square tabs. A <STRONG>bevelAmount</STRONG> of
64
          4, means that the tab will be drawn with angled corners
65
          that  cut  in  4  pixels  from the edge of the tab. The
66
          default is 0.
67
 
68
     Name:           <STRONG>command</STRONG>
69
     Class:          <STRONG>Command</STRONG>
70
     Command-Line Switch:           <STRONG>-command</STRONG>
71
     Specifes the prefix of a Tcl command to invoke to change the view in the
72
     widget associated with the tabset. When a user selects a tab, a Tcl command
73
     is invoked. The actual command consists of this option followed by a space
74
     and a number. The number is the numerical index of the tab that has been
75
     selected.
76
 
77
     Name:           <STRONG>equalTabs</STRONG>
78
     Class:          <STRONG>EqualTabs</STRONG>
79
     Command-Line Switch:           <STRONG>-equaltabs</STRONG>
80
 
81
          Specifies whether to force tabs to be  equal  sized  or
82
          not.  A  value of <STRONG>true</STRONG> means constrain tabs to be equal
83
          sized. A value of <STRONG>false</STRONG> allows each tab to  size  based
84
          on  the  text label size. The value may have any of the
85
          forms accepted by the  <STRONG>Tcl_GetBoolean</STRONG>,  such  as  <STRONG>true</STRONG>,
86
          <STRONG>false</STRONG>, <STRONG>0</STRONG>, <STRONG>1</STRONG>, <STRONG>yes</STRONG>, or <STRONG>no</STRONG>.
87
 
88
          For horizontally positioned tabs (<STRONG>tabPos</STRONG> is either <STRONG>s</STRONG> or
89
          <STRONG>n</STRONG>),  <STRONG>true</STRONG>  forces all tabs to be equal width (the width
90
          being equal to the longest label plus any  padX  speci-
91
          fied). Horizontal tabs are always equal in height.
92
 
93
          For vertically positioned tabs (<STRONG>tabPos</STRONG> is either  <STRONG>w</STRONG>  or
94
          <STRONG>e</STRONG>), <STRONG>true</STRONG> forces all tabs to be equal height (the height
95
          being equal to the height of the label with the largest
96
          font).  Vertically  oriented  tabs  are always equal in
97
          width.
98
 
99
     Name:           <STRONG>gap</STRONG>
100
     Class:          <STRONG>Gap</STRONG>
101
     Command-Line Switch:           <STRONG>-gap</STRONG>
102
 
103
          Specifies the amount of pixel space  to  place  between
104
          each tab. Value may be any pixel offset value. In addi-
105
          tion, a special keyword <STRONG>overlap</STRONG>  can  be  used  as  the
106
          value to achieve a standard overlap of tabs. This value
107
          may have any of the forms acceptable to <STRONG>Tk_GetPixels</STRONG>.
108
 
109
     Name:           <STRONG>margin</STRONG>
110
     Class:          <STRONG>Margin</STRONG>
111
     Command-Line Switch:           <STRONG>-margin</STRONG>
112
 
113
          Specifies the amount of space to place between the out-
114
          side  edge  of  the  tabset and the outside edge of its
115
          tabs. If <STRONG>tabPos</STRONG> is <STRONG>s</STRONG>,  this  is  the  amount  of  space
116
          between  the  bottom  edge of the tabset and the bottom
117
          edge of the set of tabs. If <STRONG>tabPos</STRONG> is <STRONG>n</STRONG>,  this  is  the
118
          amount  of space between the top edge of the tabset and
119
          the top edge of the set of tabs. If <STRONG>tabPos</STRONG> is  <STRONG>e</STRONG>,  this
120
          is  the  amount  of space between the right edge of the
121
          tabset and the right edge of the set of tabs. If <STRONG>tabPos</STRONG>
122
          is <STRONG>w</STRONG>, this is the amount of space between the left edge
123
          of the tabset and the left edge of  the  set  of  tabs.
124
          This  value  may  have  any  of the forms acceptable to
125
          <STRONG>Tk_GetPixels</STRONG>.
126
 
127
     Name:           <STRONG>padX</STRONG>
128
     Class:          <STRONG>PadX</STRONG>
129
     Command-Line Switch:           <STRONG>-padx</STRONG>
130
 
131
          Specifies a  non-negative  value  indicating  how  much
132
          extra  space  to  request for a tab around its label in
133
          the X-direction. When computing how large a  window  it
134
          needs,  the  tab  will  add this amount to the width it
135
          would normally need The tab  will  end  up  with  extra
136
          internal space to the left and right of its text label.
137
          This value may have any  of  the  forms  acceptable  to
138
          <STRONG>Tk_GetPixels</STRONG>.
139
 
140
     Name:           <STRONG>padY</STRONG>
141
     Class:          <STRONG>PadY</STRONG>
142
     Command-Line Switch:           <STRONG>-pady</STRONG>
143
 
144
          Specifies a  non-negative  value  indicating  how  much
145
          extra  space  to  request for a tab around its label in
146
          the Y-direction. When computing how large a  window  it
147
          needs,  the  tab  will add this amount to the height it
148
          would normally need The tab  will  end  up  with  extra
149
          internal space to the top and bottom of its text label.
150
          This value may have any  of  the  forms  acceptable  to
151
          <STRONG>Tk_GetPixels</STRONG>.
152
 
153
     Name:           <STRONG>raiseSelect</STRONG>
154
     Class:          <STRONG>RaiseSelect</STRONG>
155
     Command-Line Switch:           <STRONG>-raiseselect</STRONG>
156
 
157
          Specifes whether to slightly  raise  the  selected  tab
158
          from  the rest of the tabs. The selected tab is drawn 2
159
          pixels closer to the outside edge of  the  tabset  than
160
          the  unselected  tabs.  A  value  of true says to raise
161
          selected tabs, a value of false  turns  this  off.  The
162
          default  is  false. The value may have any of the forms
163
          accepted by the <STRONG>Tcl_GetBoolean</STRONG>, such as <STRONG>true</STRONG>, <STRONG>false</STRONG>, <STRONG>0</STRONG>,
164
          <STRONG>1</STRONG>, <STRONG>yes</STRONG>, or <STRONG>no</STRONG>.
165
 
166
     Name:           <STRONG>start</STRONG>
167
     Class:          <STRONG>Start</STRONG>
168
     Command-Line Switch:           <STRONG>-start</STRONG>
169
 
170
          Specifies the amount of space to place between the left
171
          or  top edge of the tabset and the starting edge of its
172
          tabs. For horizontally positioned  tabs,  this  is  the
173
          amount of space between the left edge of the tabset and
174
          the left edge of the first tab.  For  vertically  posi-
175
          tioned  tabs,  this  is the amount of space between the
176
          top of the tabset and the top of the  first  tab.  This
177
          value  may  change  if  the  user  performs a MButton-2
178
          scroll on the tabs. This value  may  have  any  of  the
179
          forms acceptable to <STRONG>Tk_GetPixels</STRONG>.
180
 
181
     Name:           <STRONG>state</STRONG>
182
     Class:          <STRONG>State</STRONG>
183
     Command-Line Switch:           <STRONG>-state</STRONG>
184
 
185
          Sets the active state of the tabset. Specifying  <STRONG>normal</STRONG>
186
          allows  all  tabs to be selectable. Specifying <STRONG>disabled</STRONG>
187
          disables the tabset causing all tabs to be drawn in the
188
          disabledForeground color.
189
 
190
     Name:           <STRONG>tabBorders</STRONG>
191
     Class:          <STRONG>TabBorders</STRONG>
192
     Command-Line Switch:           <STRONG>-tabborders</STRONG>
193
 
194
          Specifies whether to draw the borders of tabs that  are
195
          not selected. Specifying true (the default) draws these
196
          borders, specifying false draws only the border  around
197
          the  selected  tab. The value may have any of the forms
198
          accepted by the <STRONG>Tcl_GetBoolean</STRONG>, such as <STRONG>true</STRONG>, <STRONG>false,</STRONG> <STRONG>0</STRONG>,
199
          <STRONG>1</STRONG>, <STRONG>yes</STRONG>, or <STRONG>no</STRONG>.
200
 
201
     Name:           <STRONG>tabPos</STRONG>
202
     Class:          <STRONG>TabPos</STRONG>
203
     Command-Line Switch:           <STRONG>-tabpos</STRONG>
204
 
205
          Specifies the location of the set of tabs  in  relation
206
          to  another  widget. Must be <STRONG>n</STRONG>, <STRONG>s</STRONG>, <STRONG>e</STRONG>, or <STRONG>w</STRONG>. Defaults to
207
          <STRONG>s</STRONG>. North tabs open downward, South  tabs  open  upward.
208
          West  tabs  open  to  the  right, east tabs open to the
209
          left.
210
 
211
</PRE>
212
<H2><HR ALIGN=LEFT WIDTH=70% SIZE=3></H2><PRE>
213
 
214
 
215
</PRE>
216
<H2>DESCRIPTION</H2><PRE>
217
     The <STRONG>tabset</STRONG> command creates a new window (given by the  path-
218
     Name argument) and makes it into a <STRONG>tabset</STRONG> widget. Additional
219
     <EM>options</EM>, described above may be  specified  on  the  command
220
     line  or  in the option database to configure aspects of the
221
     tabset such as its colors, font, and text. The  <STRONG>tabset</STRONG>  com-
222
     mand returns its <EM>pathName</EM> argument. At the time this command
223
     is invoked, there must not exist a  window  named  <EM>pathName</EM>,
224
     but pathName's parent must exist.
225
 
226
     A <STRONG>tabset</STRONG> is a widget that contains a set of Tab buttons.  It
227
     displays  these tabs in a row or column depending on it tab-
228
     pos. When a tab is clicked on, it becomes the  only  tab  in
229
     the tab set that is selected. All other tabs are deselected.
230
     The Tcl command prefix associated with this tab (through the
231
     command  tab configure option) is invoked with the tab index
232
     number appended to its argument list. This allows the tabset
233
     to control another widget such as a Notebook.
234
 
235
 
236
</PRE>
237
<H2>TABS</H2><PRE>
238
     Tabs are drawn to appear attached  to  another  widget.  The
239
     tabset  draws  an edge boundary along one of its edges. This
240
     edge is known as the attachment edge. This edge location  is
241
     dependent  on the value of <STRONG>tabPos</STRONG>. For example, if <STRONG>tabPos</STRONG> is
242
     <STRONG>s</STRONG>, the attachment edge wil be on the top side of the  tabset
243
     (in  order  to  attach  to  the  bottom or south side of its
244
     attached widget). The selected tab is draw with a 3d  relief
245
     to  appear  above  the other tabs. This selected tab "opens"
246
     toward attachment edge.
247
 
248
     Tabs can be controlled in their location  along  the  edges,
249
     the  angle  that tab sides are drawn with, gap between tabs,
250
     starting margin of tabs, internal padding around labels in a
251
     tab, the font, and its text or bitmap.
252
 
253
 
254
</PRE>
255
<H2>WIDGET-SPECIFIC METHODS</H2><PRE>
256
     The <STRONG>tabset</STRONG> command creates a new Tcl command whose  name  is
257
     <EM>pathName</EM>.  This command may be used to invoke various opera-
258
     tions on the widget. It has the following general form:
259
 
260
          <EM>pathName</EM> <EM>option</EM> ?<EM>arg</EM> <EM>arg</EM> ...?
261
 
262
     <EM>option</EM> and the <EM>arg</EM>s determine the exact behavior of the com-
263
     mand.
264
 
265
     Many of the widget commands for a tabset take as  one  argu-
266
     ment  an indicator of which tab of the tabset to operate on.
267
     These indicators are called indexes and may be specified  in
268
     any of the following forms:
269
 
270
     <EM>number</EM>
271
          Specifies the tab numerically, where 0  corresponds  to
272
          the  first  tab in the tab set, 1 to the second, and so
273
          on.
274
 
275
     <STRONG>select</STRONG>
276
          Specifies the currently selected tab's index. If no tab
277
          is currently selected, the value -1 is returned.
278
 
279
     <STRONG>end</STRONG>  Specifes the last tab in the  tabset's  index.  If  the
280
          tabset is empty this will return -1.
281
 
282
     <EM>pattern</EM>
283
          If the index doesn't satisfy any of  the  above  forms,
284
          then  this  form  is  used.  Pattern is pattern-matched
285
          against the label of each tab in the tabset,  in  order
286
          from  the first to the last tab, until a matching entry
287
          is found. The rules of Tcl_StringMatch are used.
288
 
289
     The following commands are possible for tabset widgets:
290
 
291
          <EM>pathName</EM> <STRONG>add</STRONG> ?<EM>option</EM> <EM>value</EM> <EM>option</EM> <EM>value</EM> ...?
292
               Add a new tab at the end of  the  tabset.  Returns
293
               the  child  site <EM>pathName</EM>. If additional arguments
294
               are present, they specify  any  of  the  following
295
               options:
296
 
297
               <STRONG>-angle</STRONG> <EM>value</EM>
298
                    Specifes the angle of slope  from  the  inner
299
                    edge  to  the outer edge of the tab. An angle
300
                    of 0 specifies square tabs. Valid ranges  are
301
 
302
                    degrees. If this option is  specified  as  an
303
                    empty  string  (the  default), then the angle
304
                    option for the overall tabset is used.
305
 
306
               <STRONG>-background</STRONG> <EM>value</EM>
307
                    Specifies  a  background  color  to  use  for
308
                    displaying tabs when they are in their normal
309
                    state (unselected). If this option is  speci-
310
                    fied  as  an empty string (the default), then
311
                    the background option for the overall  tabset
312
                    is used.
313
 
314
               <STRONG>-bevelamount</STRONG> <EM>value</EM>
315
                    Specifes the size of tab corners. A value  of
316
 
317
                    A bevelAmount of 4, means that the  tab  will
318
                    be  drawn  with  angled corners that cut in 4
319
                    pixels from the edge of the tab. The  default
320
                    is  0. This is generally only set at the tab-
321
                    set configuration level. Tabs  normally  will
322
                    want to share the same bevelAmount.
323
 
324
               <STRONG>-bitmap</STRONG> <EM>value</EM>
325
                    If label is a non-empty string,  specifies  a
326
                    bitmap  to  display in the tab. Bitmap may be
327
                    of any of the forms accepted by Tk_GetBitmap.
328
 
329
               <STRONG>-disabledforeground</STRONG> <EM>value</EM>
330
                    Specifies  a  foreground  color  to  use  for
331
                    displaying  tab labels when tabs are in their
332
                    disable state. If this option is specified as
333
                    an empty string (the default), then the disa-
334
                    bledforeground option for the overall  tabset
335
                    is used.
336
 
337
               <STRONG>-font</STRONG> <EM>value</EM>
338
                    Specifies the font to use  when  drawing  the
339
                    label  on  a tab. If this option is specified
340
                    as an empty string then the font  option  for
341
                    the overall tabset is used.
342
 
343
               <STRONG>-foreground</STRONG> <EM>value</EM>
344
                    Specifies  a  foreground  color  to  use  for
345
                    displaying  tab labels when tabs are in their
346
                    normal unselected state. If  this  option  is
347
                    specified  as  an empty string (the default),
348
                    then the foreground option  for  the  overall
349
                    tabset is used.
350
 
351
               <STRONG>-image</STRONG> <EM>value</EM>
352
                    If label is a non-empty string, specifies  an
353
                    image  to display in the tab. Image must have
354
                    been created with the image  create  command.
355
                    Typically,  if  the image option is specified
356
                    then it overrides other options that  specify
357
                    a  bitmap  or textual value to display in the
358
                    widget; the image option may be reset  to  an
359
                    empty  string  to  re-enable a bitmap or text
360
                    display.
361
 
362
               <STRONG>-label</STRONG> <EM>value</EM>
363
                    Specifies a text string to be placed  in  the
364
                    tabs  label. If this value is set, the bitmap
365
                    option is overridden and this option is  used
366
                    instead.  This  label serves as an additional
367
                    identifier used to reference  the  tab.  This
368
                    label  may  be  used  for  the index value in
369
                    widget commands.
370
 
371
               <STRONG>-selectbackground</STRONG> <EM>value</EM>
372
                    Specifies  a  background  color  to  use  for
373
                    displaying  the  selected tab. If this option
374
                    is  specified  as  an   empty   string   (the
375
                    default),  then  the  selectBackground option
376
                    for the overall tabset is used.
377
 
378
               <STRONG>-selectforeground</STRONG> <EM>value</EM>
379
                    Specifies  a  foreground  color  to  use  for
380
                    displaying  the  selected tab. If this option
381
                    is  specified  as  an   empty   string   (the
382
                    default),  then  the  selectForeground option
383
                    for the overall tabset is used.
384
 
385
               <STRONG>-padx</STRONG> <EM>value</EM>
386
                    Specifies a non-negative value indicating how
387
                    much  extra space to request for a tab around
388
                    its label in the X-direction. When  computing
389
                    how large a window it needs, the tab will add
390
                    this amount to the width  it  would  normally
391
                    need  The tab will end up with extra internal
392
                    space to the  left  and  right  of  its  text
393
                    label.  This  value may have any of the forms
394
                    acceptable to Tk_GetPixels. If this option is
395
                    specified  as  an empty string (the default),
396
                    then the padX option for the  overall  tabset
397
                    is used
398
 
399
               <STRONG>-pady</STRONG> <EM>value</EM>
400
                    Specifies a non-negative value indicating how
401
                    much  extra space to request for a tab around
402
                    its label in the Y-direction. When  computing
403
                    how large a window it needs, the tab will add
404
                    this amount to the height it  would  normally
405
                    need  The tab will end up with extra internal
406
                    space to the  top  and  bottom  of  its  text
407
                    label.  This  value may have any of the forms
408
                    acceptable to Tk_GetPixels. If this option is
409
                    specified  as  an empty string (the default),
410
                    then the padY option for the  overall  tabset
411
                    is used
412
 
413
               <STRONG>-state</STRONG> <EM>value</EM>
414
                    Sets the state of the tab. Specifying  normal
415
                    allows  this tab to be selectable. Specifying
416
                    disabled disables the this  tab  causing  its
417
                    tab  label  to  be drawn in the disabledFore-
418
                    ground color. The tab  will  not  respond  to
419
                    events until the state is set back to normal.
420
 
421
          <EM>pathName</EM> <STRONG>configure</STRONG> ?<EM>option</EM>? ?<EM>value</EM> <EM>option</EM> <EM>value</EM> ...?
422
               Query or modify the configuration options  of  the
423
               widget.  If no <EM>option</EM> is specified, returns a list
424
               describing all of the available options for  <EM>path-</EM>
425
               <EM>Name</EM>  (see <STRONG>Tk_ConfigureInfo</STRONG> for information on the
426
               format of this list). If option is specified  with
427
               no value, then the command returns a list describ-
428
               ing the one named option (this list will be ident-
429
               ical  to  the  corresponding  sublist of the value
430
               returned if no option is  specified).  If  one  or
431
               more  option-value  pairs  are specified, then the
432
               command modifies the  given  widget  option(s)  to
433
               have  the given value(s); in this case the command
434
               returns an empty string. <EM>Option</EM> may  have  any  of
435
               the values accepted by the tabset command.
436
 
437
          <EM>pathName</EM> <STRONG>delete</STRONG> <EM>index1</EM> ?<EM>index2</EM>?
438
               Delete all of the tabs between <EM>index1</EM>  and  <EM>index2</EM>
439
               inclusive.  If  <EM>index2</EM> is omitted then it defaults
440
               to <EM>index1</EM>. Returns an empty string.
441
 
442
          <EM>pathName</EM> <STRONG>index</STRONG> <EM>index</EM>
443
               Returns  the  numerical  index  corresponding   to
444
               <EM>index</EM>.
445
 
446
          <EM>pathName</EM> <STRONG>insert</STRONG> <EM>index</EM> ?<EM>option</EM> <EM>value</EM> <EM>option</EM> <EM>value</EM> ...?
447
               Insert a new tab in  the  tabset  before  the  tab
448
               specified  by  <EM>index</EM>. The additional arguments are
449
               the same as for the <STRONG>add</STRONG> command. Returns the tab's
450
               <EM>pathName</EM>.
451
 
452
          <EM>pathName</EM> <STRONG>next</STRONG>
453
               Advances the selected tab to the next  tab  (order
454
               is   determined   by   insertion  order).  If  the
455
               currently selected tab is the last tab in the tab-
456
               set,  the selection wraps around to the first tab.
457
               It behaves as if the user selected the next tab.
458
 
459
          <EM>pathName</EM> <STRONG>tabconfigure</STRONG> <EM>index</EM> ?<EM>option</EM>? ?<EM>value</EM>?
460
               This command is similar to the <STRONG>configure</STRONG>  command,
461
               except that it applies to the options for an indi-
462
               vidual  tab,  whereas  configure  applies  to  the
463
               options  for  the  tabset  as a whole. Options may
464
               have any of the values accepted by the <STRONG>add</STRONG>  widget
465
               command.  If  options  are  specified, options are
466
               modified as indicated in the command and the  com-
467
               mand  returns  an  empty string. If no options are
468
               specified, returns a list describing  the  current
469
               options  for  tab  index (see <STRONG>Tk_ConfigureInfo</STRONG> for
470
               information on the format of this list).
471
 
472
          <EM>pathName</EM> <STRONG>prev</STRONG>
473
               Moves the selected tab to the previous tab  (order
474
               is   determined   by   insertion  order).  If  the
475
               currently selected tab is the  first  tab  in  the
476
               tabset, the selection wraps around to the last tab
477
               in the tabset. It behaves as if the user  selected
478
               the previous tab.
479
 
480
          <EM>pathName</EM> <STRONG>select</STRONG> <EM>index</EM>
481
               Selects  the  tab  specified  by  <EM>index</EM>   as   the
482
               currently  selected tab. It behaves as if the user
483
               selected the new tab.
484
 
485
 
486
 
487
</PRE>
488
<H2>EXAMPLE</H2><PRE>
489
     Following is an example that creates a tabset with two  tabs
490
     and a list box that the tabset controls. In addition select-
491
     ing an item from the list  also  selects  the  corresponding
492
     tab.
493
 
494
          # Define a proc that knows how to select an item
495
          # from a list given an index from the tabset -command callback.
496
            proc selectItem { item } {
497
              .l selection clear [.l curselection]
498
              .l selection set $item
499
              .l see $item
500
 
501
          }
502
 
503
          # Define a proc that knows how to select a tab
504
          # given a y pixel coordinate from the list..
505
            proc selectTab { y } {
506
              set whichItem [.l nearest $y]
507
              .ts select $whichItem
508
          }
509
 
510
          # Create a listbox with two items (one and two)
511
          # and bind button 1 press to the selectTab procedure.
512
            listbox .l -selectmode single -exportselection false
513
            .l insert end one
514
            .l insert end two
515
            .l selection set 0
516
            pack .l
517
            bind .l &lt;ButtonPress-1&gt; { selectTab %y }
518
 
519
          # Create a tabset, set its -command to call selectItem
520
          # Add two labels to the tabset (one and two).
521
            tabset .ts -command selectItem
522
            .ts add -label 1
523
            .ts add -label 2
524
            .ts select 0
525
            pack .ts -fill x -expand no
526
 
527
 
528
</PRE>
529
<H2>AUTHOR</H2><PRE>
530
     Bill W. Scott
531
 
532
 
533
</PRE>
534
<H2>KEYWORDS</H2><PRE>
535
     tab tabset notebook tabnotebook
536
 
537
 
538
 
539
 
540
 
541
 
542
 
543
 
544
 
545
 
546
 
547
 
548
 
549
 
550
 
551
 
552
 
553
 
554
 
555
 
556
 
557
</PRE>
558
</BODY>
559
</HTML>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.