Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  TK::DYNATABFRAME (3)

.ds Aq ’


Tk::DynaTabFrame - A NoteBook widget with orientable, dynamically stacking tabs



    use Tk::DynaTabFrame;

    $TabbedFrame = $widget->DynaTabFrame
        -font => $font,
        -raisecmd => \&raise_callback,
        -raisecolor => green,
        -tabclose => sub {
                my ($dtf, $caption) = @_;
        -tabcolor => yellow,
        -tabcurve => 2,
        -tablock => undef,
        -tabpadx => 5,
        -tabpady => 5,
        -tabrotate => 1,
        -tabside => nw,
        -tabscroll => undef,
        -textalign => 1,
        -tiptime => 600,
        -tipcolor => yellow,
        [normal frame options...],


[ NOTE: This module was based on Tk::TabFrame... but you probably can’t tell it anymore ]

A notebook widget with orientable, dynamically rearranging tabs. When the containing window is resized, the tabs will either stack or unstack as needed to fit the enclosing widget’s width(height). Likewise, when tabs are added or removed, the tabs will stack/unstack as needed.

Tabs may be placed either on the top (default), bottom, left, or right side of the widget, and may be aligned to either the left (default) or right edge for top or bottom tabs, or to the top or bottom edges for left or right tabs.

Tabs are added at the innermost row adjacent to the tabbed frame at the alignment edge, and automatically become the raised tab when added.

Separate <B>-tabcolorB> and <B>-raisecolorB> options may be specified for each tab. <B>-tabcolorB> is used for the tab if it is not the raised tab, or if no <B>-raisecolorB> is specified. <B>-raisecolorB> is used when the tab is raised.

A tab can be raised by either clicking on the tab; by using left and right keyboard arrows to traverse the tabbing order; or programmatically via the <B>B>raise()<B>B> method.

If -tabrotate is enabled, when a tab in a row other than the innermost frame-adjacent row is raised, all rows are rotated inward, with the current frame-adjacent rows wrapping to the outside, until the raised row becomes the innermost frame adjacent row. Disabling -tabrotate will leave the raised tab in its current location (assuming the containing window has not been resized; see the -tablock option to lock down the tabs on resize events).

A small close button can be applied to the tabs via the <B>-tabcloseB> option. By default, clicking the close button will delete the tab and associated frame from the DynaTabFrame. If a coderef is supplied as the <B>-tabcloseB> value, then the coderef will be invoked instead.

Either text or images can be displayed in the tab, using either the <B>-imageB> or <B>-labelB> page options. A future release will permit both in a single tab. If neither is specified, then the page name value will be used.

A flash effect may be applied to a tab (i.e., switching between the defined background color and a flash color at a specified interval) using the flash<B>()B> method. Flashing continues until either the deflash<B>()B> method is called, the tab is raised manually or programmatically, or the specified flash duration expires.

A tabtip (aka balloon or tooltip) may be attached to each tab that is displayed when the mouse hovers over the tab. The number of millseconds between the mouse entering a tab, and the display of the tabtip is determined by the -tiptime option (default 450). The background color of the tabtips can be set by the -tipcolor option (default white). The text of each tabtip can be set, updated, or removed, either in the add() method, or via pageconfigure(), using the -tabtip option. Note that a Tk::Balloon widget is not created for the DynaTabFrame widget until a -tiptime, -tipcolor, or -tabtip is configured.

The widget takes all the options that a Frame does. In addition, it supports the following options:
<B>-fontB> Font for tab text.
<B>-raisecmdB> Code ref invoked on a raise event; passed the caption of the raised page. <B>NOTE:B>This behavior is different than Tk::Notebook, which passes the widget to the callback.
<B>-raisecolorB> Sets the default raisecolor; overridden by <B>add(-raisecolor)B> option. Default is current widget background color.
<B>-tabcloseB> Add small close button to each tab; if set to a coderef, the coderef is invoked when the close button is pressed, and is passed both the Tk::DynaTabFrame object, and the caption of the associated tab. If set to a ’true’ scalar value, invokes the delete method on the associated tab. Default is no close button. When enabled with -tablock enabled, -tablock is silently ignored.
<B>-tabcolorB>, <B>-backpagecolorB> Sets the default tabcolor; overridden by the add<B>(-tabcolor)B> option. Default is current widget background color.
<B>-tabcurveB> Curve to use for top corners of tabs; set to the number of pixels of spacing between adjoining tab borders. Default 2; rarely needs adjustement.
<B>-tablockB> Locks the resize of the tabs; when set to a true value, the tabs will not be rearranged when the enclosing window is resized; default off (ie, tabs are rearranged on resize). Silently ignored when -tabclose is enabled. Note that this options does not effect the tab raise event behavior (tab rows rotate inward). See the -tabrotate option to disable that behavior.
<B>-tabpadxB> Padding on left and right of the tab contents
<B>-tabpadyB> Padding on top and bottom of the tab contents
<B>-tabrotateB> When enabled (the default), when a tab is raised in a row other than the innermost, frame-adjacent row, tab rows are rotated inward until the raised tab is frame adjacent. Disabling this option will leave the raised tab’s row at its current location until a resize event occurs. (See -tablock to lock down tab locations on resize events).
<B>-tabsideB> Side of notebook to align tabs; acceptable values:

        nw (default) - tabs on top, aligned to the left edge
        ne - tabs on top, aligned to the right edge
        sw - tabs on bottom, aligned to the left edge
        se - tabs on bottom, aligned to the right edge
        en - tabs on right, aligned to the top edge
        es - tabs on right, aligned to the bottom edge
        wn - tabs on left, aligned to the top edge
        ws - tabs on left, aligned to the bottom edge
        n  - same as nw
        s  - same as sw
        e  - same as en
        w  - same as wn

<B>Note:B> can only be set or changed prior to adding any pages; attempts to change the <B>-tabsideB> after pages have been added will be silently ignored.

<B>-tabscrollB> (not yet implemented) When set to a true value, causes tabs to be restricted to a single row, with small arrow buttons placed at either end of the row to permit scrolling the tabs into/out of the window. When a tab is programmatically raised, the tabs will be scrolled until the raised tab is visible.
<B>-textalignB> Aligns text to the tab orientation. When enabled (i.e., set to a ’true’ scalar, the default), text in tabs is aligned to the tab orientation (i.e., top and bottom tabs have horizontal text, side tabs have vertical text). When disabled (i.e., set to undef or 0), text will be vertical for top and bottom tabs, and horizontal for side tabs.
<B>-tipcolorB> Sets the background color of any tabtips (default white). Causes creation of a Tk::Balloon widget if none yet exists.
<B>-tiptimeB> Sets the integer number of milliseconds to delay between the time the mouse enters a tab and the display of any defined tabtip. Default 450. Causes creation of a Tk::Balloon widget if none yet exists.

Additional BIcget() -options

<B>-currentB>, <B>-raisedB> Returns the currently raised frame.
<B>-raised_nameB> Returns the page name of the currently raised frame
<B>-tabsB> Returns a hashref of the tab Button widgets, keyed by the associated caption.


The following methods may be used with a DynaTabFrame object in addition to standard methods.
<B>add(B>[ pageName, ] options<B>)B> Adds a page with name pageName (if provided) to the notebook. Returns an object of type <B>FrameB>. If no pageName is supplied, then the <B>-captionB> option value will be used. If neither is provided, then the name is the string representation of the created page’s frame. Recognized options are:
<B>-captionB> Specifies the identifying name for the page. Also used for the tab text if no <B>-labelB> or <B>-imageB> is specified. If this option is specified, and the optional pageName argument is specified, pageName overrides this option.
<B>-hiddenB> When set to a true value, causes the resulting tab to be hidden from view; can later be set to a false value to force the tab to be visible again.
<B>-imageB> Specifies an image to display on the tab of this page. The image is displayed only if the <B>-labelB> option is not specified.
<B>-labelB> Specifies the text string to display on the tab of this page.
<B>-raisecmdB> Specifies a callback to be called whenever this page is raised by the user. Overrides the widget-level <B>-raisecmdB> option only for this tab. <B>NOTE:B> This option’s behavior is different from the Tk::Notebook, in that the callback is passed the name of the page, rather than the widget.
<B>-raisecolorB> Specifies the raised background color for the tab. Overrides the widget-level <B>-raisecolorB> option for only this tab.
<B>-tabcolorB> Specifies the unraised background color for the tab. Overrides the widget-level <B>-tabcolor/-backpagecolorB> option for only this tab.
<B>-tabtipB> Specifies the text of a tabtip to attach to the created tab. Causes creation of a Tk::Balloon widget if none yet exists.
<B>deflash(B>pageName<B>)B> Turns off flashing for the specified pageName.
<B>delete(B>pageName<B>)B> Deletes the page identified by pageName.
<B>flash(B>pageName, options<B>)B> Flashes the tab for the specified pageName. Flashing continues until either the <B>-durationB> has expired, the tab is raised (either by clicking the tab, or programmatically), or deflash is called on the page. options include
<B>-colorB> Color to use for flashing. Flashing alternates between the current -tabcolor (or -raisecolor if the tab is raised), and this color. Default is ’blue’.
<B>-intervalB> Number of milliseconds between flashes. Default is 300.
<B>-durationB> Duration of the flash in milliseconds. Default is 5000 (i.e., 5 secs).
<B>pagecget(B>pageName, -option<B>)B> Returns the current value of the configuration option given by -option in the page given by pageName. -option may be any of the values accepted in the add method, plus the <B>-stateB> option.
<B>pageconfigure(B>pageName, -option<B>)B> Like configure for the page indicated by pageName. -options may be any of the options accepted by the add method, plus the <B>-stateB> option.

Note that configuring the -tabtip option to undef will remove the tabtip from the page.

<B>pagesB> Returns a list consisting of the names of all currently defined pages, i.e., those created with the <B>addB> method.
<B>raise(B>pageName<B>)B> Raise the page identified by pageName. Returns the Frame widget of the page.
<B>B>raised()<B>B>, <B>B>current()<B>B> Returns the currently raised Frame widget. <B>NOTE:B> This method behavior differs from the Tk::Notebook method of the same, which returns the page name. Use the raised_name() method to mimic Tk::Notebook behavior.
<B>B>raised_name()<B>B> Returns the page name of the currently raised frame


<B>OptionalB> horizontal scrolled frames (ie, ’os’) seem to cause some race conditions (Config events keep resizing the frame up, then down). Use mandatory scrollbars if you need horizontal scrollbars.

Support for rotated text in left or right side tabs is lacking, due to the lack of a consistent text rotation method in Perl/Tk. While the issue can be alleviated using the -textalign option, another possible solution may be either Tk::Win32RotLabel on Win32 platforms, or Tk::CanvasRottext for *nix platforms. Unfortunately, vertical text is less than aesthetically pleasing, and can consume a rather large vertical area; using images with attached balloons may be a preferable alternative.

As of v. 0.20, better compatibility with Tk::Notebook has been provided. However, DTF is not yet fully backward compatible, as some methods and options of the same name could not be changed from prior versions of DTF in order to preserve backward compatibility.

As of V 0.20, the maximum number of tab rows is 21. This arbitrary limit is imposed due to odd behavior when redrawing the tabs on a resize event. Pseudo tabs are used to provide the illusion of tabs embedded into a frame-spanning row. If these pseudotabs are destroyed and recreated during a resize event <B>while the mouse button is still held down on the window resizerB>, the window will snap back to its original dimensions when the new pseudotabs are <B>B>place()<B>’dB>. The only solution seems to be to create a fixed number of pseudotabs at startup, and <B>B>place()<B>B> them as needed during the redraw. Eventually, a widget attribute may be added to specify the max number of rows to permit.

-tabclose and -tablock are mutually exclusive; if both are enabled, -tablock will be silently ignored.

Using Tk::Compound objects as tab images appears to cause sizing and layout issues due to the object not reporting its true full layout size; hence, they should be avoided.


Canvas based tabs Currently tabs are drawn as frames with a button (plus optional close button), and the text or image is added to the button. This limits the layout of tabs to square boxes. By converting the ButtonFrame to a Canvas, and just building, binding, and moving objects on the canvas when a redraw occurs, we can have a much more flexible tab layout (image+text, nice curved tabs, etc.).
Configurable <B>-tabcloseB> button Currently, only a close button is implemented with a fixed image. In future, the button image may be configurable, e.g., set to a minimize image and set a minimize callback for an MDI-type notebook.
Configurable <B>-tabsideB> <B>configure(B>-tabside<B>)B> should be permitted after pages are added.
Rotated tab text using GD Newer versions of GD provides better font support, with 90 degree rotation. By using GD to render and rotate the tab text as an image, sideways text can be used in tabs as images.
Single row, scrolled tabs Support for scrolling tabs, rather than stacking, should be added with small arrow buttons added at either end of the tab row when some tabs exist beyond the beginning/end of the row.


Dean Arnold             <>

Portions of the POD derived from Tk::Notebook.

Initial code derived from Tk::TabFrame, included in Tk-DKW bundle by Damion K. Wilson.

Copyright(c) 2003-2005, Dean Arnold, Presicient Corp., USA. All rights reserved.

Portions Copyright(c) 1998-1999 Damion K. Wilson, all rights reserved.

This code and documentation may be distributed under the same conditions as Perl itself.


May 22, 2005 : Ver. 0.22 - added -hidden page option

- added -tiptime, -tipcolor global attributes

- added -tabtip page option

January 10, 2005 : Ver. 0.20 - added -tabclose

- added -tabside

- added -image attribute to add() to support images in tabs

- added -label attribute to add() to support alternate text in tabs

- fixed -raisecolor behavior to revert color of prior raised tab

- fixed roaming tab connector frame

- code mods for performance

- added -tabcolor/-backpagecolor, -raisecolor widget level options

- added -raisecmd attribute to add() to support event callback

- added some Tk::Notebook drop-in compatibility (pagecget(), pageconfigure(), pages(), raised())

- POD enhancements

- added -textalign

- added -tabrotate

- added flash(), deflash()

March 14, 2004 : Ver. 0.07 - added -raisecolor to set the color of a tab when raised

- increased ConfigDebounce width threshold for ptk804.025beta

January 16, 2004 : Ver. 0.06 - fixed programmatic raise

- added (simple) install test

- added programmatic raise button to demo app

- added flash()

January 13, 2004 : Ver. 0.05 - added pseudo-tabs to backfill the space between the right side of last tab in a row, and the right side of the enclosing frame
January 6, 2004 : Ver. 0.04 - fixed TabRemove for remove from arbitrary position

- updated demo app to exersize arbitrary position removal

- fixed apparent timing issue with TabRemove and resizing that caused occasional phantom client entries

January 5, 2004 : Ver. 0.03 - added raised_name() method/-raised_name property to return caption of currently raised page

- fixed tab ordering on resize when raised tab gets moved to other than bottom row

December 29, 2003 : Ver. 0.02 - improve raise behavior

- improve tab font behavior (use platform/application default when none specified)

- added tablock option

December 25, 2003 : Ver. 0.01 - Converted from Tk::TabFrame


Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 2697: =over without closing =back
Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 DYNATABFRAME (3) 2005-05-25

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.