hwtk::notebook
Multi-pane container widget.
Format
hwtk::notebook - pathName ?option value? …
Description
A hwtk::notebook widget manages a collection of windows and displays a single one at a time. Each slave window is associated with a tab, which the user may select to change the currently-displayed window.
Standard Options
- -clientdata
- Database name: clientData
- -cursor
- Database name: cursor
- -height
- Database name: height
- -helpcommand
- Database name: helpcommand
- -takefocus
- Database name: takeFocus
- -width
- Database name: width
Widget-Specific Options
- -padding
- Database name: padding
Tab Options
- -state
- Database name: state
- -sticky
- Database name: sticky
- -padding
- Database name: padding
- -text
- Database name: text
- -image
- Database name: image
- -compound
- Database name: compound
- -underline
- Database name: underline
Widget Command
- pathName configure ?option? ?value option value …?
- Query or modify the configuration options of the widget. 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. If option is specified with no value, then the command returns a list describing the named option: the elements of the list are the option name, database name, database class, default value, and current value. If no option is specified, returns a list describing all of the available options for pathName.
- pathName cget option
- Returns the current value of the configuration option given by option.
- pathName identify element x y
- Returns the name of the element under the point given by x and y, or an empty string if the point does not lie within any element. x and y are pixel coordinates relative to the widget. Some widgets accept other identify subcommands.
- pathName instate statespec ?script?
- Test the widget’s state. If script is not specified, returns 1 if the
widget state matches statespec and 0 otherwise. If script is specified,
equivalent to
if{[pathNameinstatestateSpec]}script
- pathName state ?stateSpec?
- Modify or inquire widget state. If stateSpec is
present, sets the widget state: for each flag in
stateSpec, sets the corresponding flag or clears it
if prefixed by an exclamation point. Returns a new state spec indicating
which flags were changed:
will restore pathName to the original state. If stateSpec is not specified, returns a list of the currently-enabled state flags.setchanges[pathNamestatespec]
pathNamestate$changes
- pathName add window ?options?
- Adds a new tab to the notebook. See Tab Options above for the list of available options. If window is currently managed by the notebook but hidden, it is restored to its previous position.
- pathName forget window
- Removes the tab specified by window, unmaps and unmanages the associated window.
- pathName hide window
- Hides the tab specified by window. The tab will not be displayed, but the associated window remains managed by the notebook and its configuration remembered. Hidden tabs may be restored with the add command.
- pathName insert pos subwindow options...
- Inserts a pane at the specified position. pos is either
the string
end
, an integer index, or the name of a managed subwindow. If subwindow is already managed by the notebook, moves it to the specified position. See Tab Options above for the list of available options. - pathName select tabid
- Selects the specified tab. The associated slave window will be displayed, and the previously-selected window (if different) is unmapped. If tabid is omitted, returns the widget name of the currently selected pane.
- pathName tab tabid?-option?value…
- Query or modify the options of the specific tab. If no -option is specified, returns a dictionary of the tab option values. If one -option is specified, returns the value of that option. Otherwise, sets the -option to the corresponding value. See Tab Options above for the available options.
- pathName tabs
- Returns the list of windows managed by the notebook.
Example
hwtk::dialog .d -title "::hwtk::notebook"
set d [.d recess]
pack [hwtk::notebook $d.nb] -fill both -expand true
$d.nb add[frame $d.nb.f1] -text "First tab"
$d.nb add[frame $d.nb.f2] -text "Second tab"
$d.nb select $d.nb.f2
.d post