tabnotebook - create and manipulate tabnotebook widgets
tabnotebook pathName? options?
itk::Widget <- tabnotebook
background disabledForeground foregroundscrollCommand cursor font height width
options.
of the tab. An angle of 0 specifies square tabs. Valid ranges
are 0 to 45 degrees inclusive. Default is 15 degrees. If tabPos
is e or w, this option is ignored.
rithm of the notebook. A value of true indicates that page frames will be unpacked and packed acoording to the algorithm described in the select command. A value of false leaves the current page packed and subsequent selects, next, or previous commands do not switch pages automatically. In either case the page's associated command (see the add command's description of the command option) is invoked. The value may have any of the forms accepted by the
area behind the tabs.
associated tab. This can be thought of as the selected tab back-
ground color, since the tab associated with the selected page is
the selected tab.
0 results in square tabs. A bevelAmount of 4, means that the tab
will be drawn with angled corners that cut in 4 pixels from the
edge of the tab. The default is 0.
book area of the tabnotebook. The default value is 2.
when its state is disabled.
of true means constrain tabs to be equal sized. A value of false
allows each tab to size based on the text label size. The value
may have any of the forms accepted by the Tcl_GetBoolean, such as
true, false, 0, 1, yes, or no.
forces all tabs to be equal width (the width being equal to the
longest label plus any padX specified). Horizontal tabs are
always equal in height.
forces all tabs to be equal height (the height being equal to the
height of the label with the largest font). Vertically oriented
tabs are always equal in width.
associated tab label. This can be thought of as the selected tab
background color, since the tab associated with the selected page
is the selected tab.
word overlap can be used as the value to achieve a standard over- lap of tabs. This value may have any of the forms acceptable to
of the tabnotebook and the outside edge of its tabs. If tabPos is s, this is the amount of space between the bottom edge of the tabnotebook and the bottom edge of the set of tabs. If tabPos is n, this is the amount of space between the top edge of the tab- notebook and the top edge of the set of tabs. If tabPos is e, this is the amount of space between the right edge of the tab- notebook and the right edge of the set of tabs. If tabPos is w, this is the amount of space between the left edge of the tabnote- book and the left edge of the set of tabs. This value may have any of the forms acceptable to Tk_GetPixels.
request for a tab around its label in the X-direction. When com- puting how large a window it needs, the tab will add this amount to the width it would normally need The tab will end up with extra internal space to the left and right of its text label.
request for a tab around its label in the Y-direction. When com- puting how large a window it needs, the tab will add this amount to the height it would normally need The tab will end up with extra internal space to the top and bottom of its text label.
of the tabs. The selected tab is drawn 2 pixels closer to the
outside of the tabnotebook than the unselected tabs. A value of
true says to raise selected tabs, a value of false turns this
feature off. The default is false. The value may have any of the
forms accepted by the Tcl_GetBoolean, such as true, false, 0, 1,
yes, or no.
edge of the tabnotebook and the starting edge of its tabs. For horizontally positioned tabs, this is the amount of space between the left edge of the notebook and the left edge of the first tab.
between the top of the notebook and the top of the first tab.
the tabs. This value may have any of the forms acceptable to
allows all pages to be selectable. Specifying disabled disables the notebook causing all page tabs to be drawn in the disabled-
grounds when they are in their unselected state. This is the
background associated with tabs on all pages other than the
selected page.
selected. Specifying true (the default) draws these borders, specifying false draws only the border around the selected tab.
when they are in their unselected state. This is the foreground associated with tabs on all pages other than the selected page.
notebook area. Must be n, s, e, or w. Defaults to s. _________________________________________________________________
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 path-
displays one page from the set as the selected page. A Tab dis-
plays 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 tabnote-
book has no pages. Pages may be added or deleted using widget
commands described below.
option specifies whether the tabnotebook will automatically han- dle the unpacking and packing of pages when pages are selected. A value of true signifies that the notebook will automatically man- age it. This is the default value. A value of false signifies the notebook will not perform automatic switching of pages.
page's child site frame serves as a geometry container for appli-
cations to pack widgets into. It is this frame that is automati-
cally unpacked or packed when the auto option is true. This cre-
ates 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 tab-
notebook's child site frame.
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.
mand 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.
widgets that obey the scrollcommand protocol. By giving a scroll- bar a -command to call the tabnotebook's select method, the tab- notebook can be controlled with a scrollbar.
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.
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 mar-
gins; tabs may appear in a wide variety of styles. For example,
it is possible to implement Microsoft-style tabs, Borland prop-
erty tab styles, or Borland Delphi style tabs all with the same
tabnotebook.
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.
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
page in the notebook, 1 to the second, and so on.
select
rently selected, the value -1 is returned.
end
book is empty this will return -1.
pattern
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_String-
book widgets:
pathName add ?option value option value ...?
frame is created. Returns the child site pathName. If additional
arguments are present, they specify any of the following options:
-angle value
of the tab. An angle of 0 specifies square tabs. Valid ranges are
0 to 45 degrees inclusive. Default is 15 degrees. If this option
is specified as an empty string (the default), then the angle
option for the overall tabnotebook is used. This is generally
only set at the tabnotebook level. Tabs normally will want to
share the same angle value.
-background value
are selected and for displaying the current page. If this option
is specified as an empty string (the default), then the back-
ground option for the overall tabnotebook is used.
-bevelamount value
0 results in square tabs. A bevelAmount of 4, means that the tab
will be drawn with angled corners that cut in 4 pixels from the
edge of the tab. The default is 0. This is generally only set at
the tabnotebook level. Tabs normally will want to share the same
bevelAmount.
-bitmap value
this page's tab. Bitmap may be of any of the forms accepted by
-command value
selected. This allows the programmer a hook to reconfigure this
page's widgets or any other page's widgets.
is selected this command will be called immediately after the previously selected page is unpacked and immediately before this page is selected. The index value select is valid during this Tcl command. `index select' will return this page's page number.
unpack and pack calls are bypassed. This Tcl command is still
called.
-disabledforeground value
when tabs are in their disable state. If this option is specified
as an empty string (the default), then the disabledforeground
option for the overall tabnotebook is used.
-font value
tab. If this option is specified as an empty string then the font option for the overall tabnotebook is used..
when they are selected. If this option is specified as an empty
string (the default), then the foreground option for the overall
tabnotebook is used.
-label value
book page. This label serves as an additional identifier used to
reference the page. This label may be used for the index value in
widget commands.
-tabbackground value
is not elected. If this option is specified as an empty string
(the default), then the tabBackground option for the overall tab-
notebook is used.
-tabforeground value
label when it is not selected. If this option is specified as an
empty string (the default), then the tabForeground option for the
overall tabnotebook is used.
-padx value
request for a tab around its label in the X-direction. When com- puting how large a window it needs, the tab will add this amount to the width it would normally need The tab will end up with extra internal space to the left and right of its text label.
then the padX option for the overall tabnotebook is used
-pady value
request for a tab around its label in the Y-direction. When com- puting how large a window it needs, the tab will add this amount to the height it would normally need The tab will end up with extra internal space to the top and bottom of its text label.
then the padY option for the overall tabnotebook is used
-state value
normal state unselected tabs are displayed using the tabfore- ground and tabbackground option from the tabnotebook or the page.
background option from the tabnotebook or the page. The disabled
state means that the page and its tab is insensitive: it doesn't
respond to mouse button presses or releases. In this state the
entry is displayed according to its disabledForeground option for
the tabnotebook and the background/tabbackground option from the
page or the tabnotebook.
pathName childSite ?index?
pages in the tabnotebook. If the tab notebook is empty, an empty
list is returned
site frame specified by index. Widgets that are created with this pathName will be displayed when the associated page is selected.
pathName configure ?option? ?value option value ...?
option is specified, returns a list describing all of the avail-
able 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?
index2 is omitted then it defaults to index1. Returns an empty
string.
pathName index index
pathName insert index ?option value option value ...?
index. A new child site frame is created. The additional argu-
ments are the same as for the add command. Returns the child site
pathName.
pathName next
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.
is unpacked from the notebook's child site frame. Then the next page's child site is packed into the notebook's child site frame.
between these two operations.
the command option will be invoked.
pathName pageconfigure index ?option? ?value option value ...?
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
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.
is unpacked from the notebook's child site frame. Then the previ-
ous page's child site is packed into the notebook's child site
frame. The Tcl command given with the command option will be
invoked between these two operations.
the command option will be invoked.
pathName select index
page. It behaves as if the user selected the new page.
is unpacked from the notebook's child site frame. Then the index page's child site is packed into the notebook's child site frame.
between these two operations.
the command option will be invoked.
pathName view
bility with the scrollbar widget.
pathName view index
page. This command is for compatibility with the scrollbar wid-
get.
pathName view moveto fraction
move to. This command is for compatibility with the scrollbar
widget.
pathName view scroll num what
backward (num can be negative or positive). The what argument is
ignored. This command is for compatibility with the scrollbar
widget.
notebook are controlled via the pageconfigure method. The fol- lowing section documents these two components.
associated with the notebook component.
component item.
contains the pages of the tabnotebook.
book component item.
pages.
# Create the tabnotebook widget and pack it.
tabnotebook .tn -width 100 -height 100
pack .tn \
-anchor nw \
-fill both \
-expand yes \
-side left \
-padx 10 \
-pady 10
# Add two pages to the tabnotebook,
# labelled «Page One» and «Page Two"
.tn add -label «Page One"
.tn add -label «Page Two"
# Get the child site frames of these two pages.
set page1CS [.tn childsite 0]
set page2CS [.tn childsite «Page Two"]
# Create buttons on each page of the tabnotebook.
button $page1CS.b -text «Button One"
pack $page1CS.b
button $page2CS.b -text «Button Two"
pack $page2CS.b
# Select the first page of the tabnotebook.
.tn select 0
tab tabset notebook tabnotebook page