tabnotebook - create and manipulate tabnotebook widgets

SYNOPSIS

tabnotebook pathName? options?

INHERITANCE

itk::Widget <- tabnotebook

STANDARD OPTIONS

background
cursor
disabledForeground
font
foreground
height
scrollCommand
width

See the "options" manual entry for details on the standard options.

WIDGET-SPECIFIC OPTIONS

Name:                   angle
Class:                  Angle
Command-Line Switch:	-angle

Name:                   auto
Class:                  Auto
Command-Line Switch:	-auto

Name:                   backdrop
Class:                  Backdrop
Command-Line Switch:	-backdrop

Name:                   background
Class:                  Background
Command-Line Switch:	-background

Name:                   bevelAmount
Class:                  BevelAmount
Command-Line Switch:	-bevelamount

Name:                   borderWidth
Class:                  BorderWidth
Command-Line Switch:	-borderwidth

Name:                   disabledForeground
Class:                  DisabledForeground
Command-Line Switch:	-disabledforeground

Name:                   equalTabs
Class:                  EqualTabs
Command-Line Switch:	-equaltabs

Name:                   foreground
Class:                  Foreground
Command-Line Switch:	-foreground

Name:                   gap
Class:                  Gap
Command-Line Switch:	-gap

Name:                   margin
Class:                  Margin
Command-Line Switch:	-Bmargin

Name:                   padX
Class:                  PadX
Command-Line Switch:	-padx

Name:                   padY
Class:                  PadY
Command-Line Switch:	-pady

Name:                   raiseSelect
Class:                  RaiseSelect
Command-Line Switch:	-raiseselect

Name:                   start
Class:                  Start
Command-Line Switch:	-start

Name:                   state
Class:                  State
Command-Line Switch:	-state

Name:                   tabBackground
Class:                  TabBackground
Command-Line Switch:	-tabbackground

Name:                   tabBorders
Class:                  TabBorders
Command-Line Switch:	-tabborders

Name:                   tabForeground
Class:                  TabForeground
Command-Line Switch:	-tabforeground

Name:                   tabPos
Class:                  TabPos
Command-Line Switch:	-tabpos

DESCRIPTION

The tabnotebook command creates a new window (given by the pathName argument) and makes it into a tabnotebook widget. Additional options, described above may be specified on the command line or in the option database to configure aspects of the tabnotebook such as its colors, font, and text. The tabnotebook command returns its pathName argument. At the time this command is invoked, there must not exist a window named pathName, but pathName's parent must exist.

A tabnotebook is a widget that contains a set of tabbed pages. It displays one page from the set as the selected page. A Tab displays the label for the page to which it is attached and serves as a page selector. When a page's tab is selected, the page's contents are displayed in the page area. The selected tab has a three-dimensional effect to make it appear to float above the other tabs. The tabs are displayed as a group along either the left, top, right, or bottom edge. When first created a tabnotebook has no pages. Pages may be added or deleted using widget commands described below.

A special option may be provided to the tabnotebook. The -auto option specifies whether the tabnotebook will automatically handle the unpacking and packing of pages when pages are selected. A value of true signifies that the notebook will automatically manage it. This is the default value. A value of false signifies the notebook will not perform automatic switching of pages.

NOTEBOOK PAGES

A tabnotebook's pages area contains a single child site frame. When a new page is created it is a child of this frame. The page's child site frame serves as a geometry container for applications to pack widgets into. It is this frame that is automatically unpacked or packed when the auto option is true. This creates the effect of one page being visible at a time. When a new page is selected, the previously selected page's child site frame is automatically unpacked from the tabnotebook's child site frame and the newly selected page's child site is packed into the tabnotebook's child site frame.

However, sometimes it is desirable to handle page changes in a different manner. By specifying the auto option as false, child site packing can be disabled and done differently. For example, all widgets might be packed into the first page's child site frame. Then when a new page is selected, the application can reconfigure the widgets and give the appearance that the page was flipped.

In both cases the command option for a page specifies a Tcl Command to execute when the page is selected. In the case of auto being true, it is between the unpacking of the previously selected page and the packing of the newly selected page.

Notebook pages can also be controlled with scroll bars or other widgets that obey the scrollcommand protocol. By giving a scrollbar a -command to call the tabnotebook's select method, the tabnotebook can be controlled with a scrollbar.

The notebook area is implemented with the notebook mega widget.

TABS

Tabs appear along the edge of the notebook area. Tabs are drawn to appear attached to their associated page. When a tab is clicked on, the associated page is selected and the tab is drawn as raised above all other tabs and as a seamless part of its notebook page. Tabs can be controlled in their location along the edges, the angle tab sides are drawn with, gap between tabs, starting margin of tabs, internal padding around text labels in a tab, the font, and its label.

The Tab area is implemented with the tabset mega widget. See tabset(1). Tabs may be oriented along either the north, south, east, or west sides with the tabPos option. North and south tabs may appear as angled, square, or bevelled. West and east tabs may appear as square or bevelled. By changing tab gaps, tab angles, bevelling, orientations, colors, fonts, start locations, and margins; tabs may appear in a wide variety of styles. For example, it is possible to implement Microsoft-style tabs, Borland property tab styles, or Borland Delphi style tabs all with the same tabnotebook.

WIDGET-SPECIFIC METHODS

The tabnotebook command creates a new Tcl command whose name is pathName. This command may be used to invoke various operations on the widget. It has the following general form:

pathName option ?arg arg ...?
option and the args determine the exact behavior of the command.

Many of the widget commands for a notebook take as one argument an indicator of which page of the notebook to operate on. These indicators are called indexes and may be specified in any of the following forms:

number
Specifies the page numerically, where 0 corresponds to the first page in the notebook, 1 to the second, and so on.
select
Specifies the currently selected page's index. If no page is currently selected, the value -1 is returned.
end
Specifes the last page in the tabnotebook's index. If the notebook is empty this will return -1.
pattern
If the index doesn't satisfy any of the above forms, then this form is used. Pattern is pattern-matched against the label of each page in the notebook, in order from the first to the last page, until a matching entry is found. The rules of Tcl_StringMatch are used. '............................................................................. The following commands are possible for tabnotebook widgets:
pathName add ?option value option value ...?
Add a new page at the end of the tabnotebook. A new child site frame is created. Returns the child site pathName. If additional arguments are present, they specify any of the following options:
'>>>>>>>>>>
pathName childSite ?index? If passed no arguments, returns a list of pathNames for all the pages in the tabnotebook. If the tab notebook is empty, an empty list is returned
pathName configure ?option? ?value option value ...?
Query or modify the configuration options of the widget. If no option is specified, returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. Option may have any of the values accepted by the tabnotebook command.
pathName delete index1 ?index2?
Delete all of the pages between index1 and index2 inclusive. If index2 is omitted then it defaults to index1. Returns an empty string.
pathName index index
Returns the numerical index corresponding to index.
pathName insert index ?option value option value ...?
Insert a new page in the tabnotebook before the page specified by index. A new child site frame is created. The additional arguments are the same as for the add command. Returns the child site pathName.
pathName next
Advances the selected page to the next page (order is determined by insertion order). If the currently selected page is the last page in the notebook, the selection wraps around to the first page in the notebook. It behaves as if the user selected the new page.
pathName pageconfigure index ?option? ?value option value ...?
This command is similar to the configure command, except that it applies to the options for an individual page, whereas configure applies to the options for the tabnotebook as a whole. Options may have any of the values accepted by the add widget command. If options are specified, options are modified as indicated in the command and the command returns an empty string. If no options are specified, returns a list describing the current options for page index (see Tk_ConfigureInfo for information on the format of this list).
pathName prev
Moves the selected page to the previous page (order is determined by insertion order). If the currently selected page is the first page in the notebook, the selection wraps around to the last page in the notebook. It behaves as if the user selected the new page.
pathName select index
Selects the page specified by index as the currently selected page. It behaves as if the user selected the new page.
pathName view
Returns the currently selected page. This command is for compatibility with the scrollbar widget.
pathName view index
Selects the page specified by index as the currently selected page. This command is for compatibility with the scrollbar widget.
pathName view moveto fraction
Uses the fraction value to determine the corresponding page to move to. This command is for compatibility with the scrollbar widget.
pathName view scroll num what
Uses the num value to determine how many pages to move forward or backward (num can be negative or positive). The what argument is ignored. This command is for compatibility with the scrollbar widget.

COMPONENTS

Generally all behavior of the internal components, tabset and notebook are controlled via the pageconfigure method. The following section documents these two components.

Name:                   tabset
Class:                  Tabset

Name:                   notebook
Class:                  Notebook

EXAMPLE

Following is an example that creates a tabnotebook with two pages.


    the
    pack
    -width
    pack
    nw
    \\
    -side
    10

      pages
      #
      and
      add
      .tn
      Two"
      Get
      frames
      pages.
      childsite
      [.tn

    buttons
    of
    $page1CS.b
    pack
    -text
    $page2CS.b
    Select
    of
    select

tabnotebook
it.
100
.tn
\\
-expand
left
\\
#
to
labelled
"Page
-label
add

the
of
set
0]
childsite

    on
    the
    -text
    $page1CS.b
    "Button

the
the
0
#
widget
tabnotebook
-height
\\
-fill
yes
\\
-pady
Add
the
"Page
Two"
"Page
-label

    child
    these
    page1CS
    set
    "Page
    #
    each
    tabnotebook.
    "Button
    button
    Two"

      first
      tabnotebook.

Create
and
.tn
100
-anchor
both
\\
-padx
10
two
tabnotebook,
One"
.tn
One"
"Page
#
site
two
[.tn
page2CS
Two"]
Create
page
button
One"
$page2CS.b
pack
#
page
.tn

AUTHOR

Bill W. Scott

KEYWORDS

tab tabset notebook tabnotebook page