Tk::NoteBook - display several windows in limited space with notebook metaphor.
$w = $frame->NoteBook();
$page1 = $w->add("page1", options);
$page2 = $w->add("page2", options);
$page2 = $w->add("page2", options);
The NoteBook widget provides a notebook metaphor to display several windows in limited space. The notebook is divided into a stack of pages of which only one is displayed at any time. The other pages can be selected by means of choosing the visual "tabs" at the top of the widget. Additionally, the <Tab> key may be used to traverse the pages. If -underline is used, Alt- bindings will also work.
The widget takes all the options that a Frame does. In addition, it supports the following options:
If set to false (default and recommended), the size of the NoteBook will match the size of the largest page. Otherwise the size will match the size of the current page causing the NoteBook to change size when different pages of different sizes are selected.
The amount of internal horizontal padding around the pages.
The amount of internal vertical padding around the pages.
The background color of the tabs and back page.
The color of the focus border around the tabs.
The font of the tab labels.
Horizonzal padding around the tab label.
Vertical padding around the tab label.
The following methods may be used with a NoteBook object in addition to standard methods.
Adds a page with name pageName to the notebook. Returns an object of type Frame. The recognized options are:
Specifies how the information in a tab is to be displayed. Must be one of n, ne, e, se, s, sw, w, nw or center.
Specifies a bitmap to display on the tab of this page. The bitmap is displayed only if none of the -label or -image options are specified.
Specifies an image to display on the tab of this page. The image is displayed only if the -label option is not specified.
Specifies the text string to display on the tab of this page.
When there are multiple lines of text displayed in a tab, this option determines the justification of the lines.
Specifies a callback to be called the first time the page is shown on the screen. This option can be used to delay the creation of the contents of a page until necessary. It can be useful in situations where there are a large number of pages in a NoteBook widget; with -createcmd you do not have to make the user wait until all pages are constructed before displaying the first page.
Specifies a callback to be called whenever this page is raised by the user.
Specifies whether this page can be raised by the user. Must be either normal or disabled.
Specifies the integer index of a character to underline in the tab. This option is used by the default bindings to implement keyboard traversal for menu buttons and menu entries. 0 corresponds to the first character of text displayed on the widget, 1 to the next character and so on.
This option specifies the maximum line length of the label string on this tab. If the line length of the label string exceeds this length, then it is wrapped onto the next line so that no line is longer than the specified length. The value may be specified in any standard forms for screen distances. If this value is less than or equal to 0, then no wrapping is done: lines will break only at newline characters in the text.
Deletes the page identified by pageName.
Returns the current value of the configuration option given by -option in the page given by pageName. Option may have any of the values accepted in the add method.
Like configure for the page indicated by pageName. Options may be any of the options accepted by the add method.
Returns a list consisting of the names of all currently defined pages, i.e., those created with the add method.
Returns the page with name pageName.
Raise the page identified by pageName.
Returns the name of the currently raised page.
Return the dimensions of the tab area.
Identify the tab's page name under the specified coordinates. Return an empty string if there's no tab.
Return a list of all pages.
Return the page name of the tab with the current focus.
Return the page name of the tab which would receive the next focus.
Return the page name of the tab which had the previous focus.
Return the page name of the active tab.
The options -width and -height do not work.
Rajappa Iyer <firstname.lastname@example.org> Nick Ing-Simmons <email@example.com>
This code and documentation was derived from NoteBook.tcl in Tix4.0 written by Ioi Lam. It may be distributed under the same conditions as Perl itself.
To install Tk, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.