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