Tk::ToolBar 0.09 review
DownloadTk::ToolBar is a toolbar widget for Perl/Tk. SYNOPSIS use Tk; use Tk::ToolBar; my $mw = new MainWin
|
|
Tk::ToolBar is a toolbar widget for Perl/Tk.
SYNOPSIS
use Tk;
use Tk::ToolBar;
my $mw = new MainWindow;
my $tb = $mw->ToolBar(qw/-movable 1 -side top
-indicatorcolor blue/);
$tb->ToolButton (-text => 'Button',
-tip => 'tool tip',
-command => sub { print "hin" });
$tb->ToolLabel (-text => 'A Label');
$tb->Label (-text => 'Another Label');
$tb->ToolLabEntry(-label => 'A LabEntry',
-labelPack => [-side => "left",
-anchor => "w"]);
my $tb2 = $mw->ToolBar;
$tb2->ToolButton(-image => 'navback22',
-tip => 'back',
-command => &back);
$tb2->ToolButton(-image => 'navforward22',
-tip => 'forward',
-command => &forward);
$tb2->separator;
$tb2->ToolButton(-image => 'navhome22',
-tip => 'home',
-command => &home);
$tb2->ToolButton(-image => 'actreload22',
-tip => 'reload',
-command => &reload);
MainLoop;
This module implements a dockable toolbar. It is in the same spirit as the "short-cut" toolbars found in most major applications, such as most web browsers and text editors (where you find the "back" or "save" and other shortcut buttons).
Buttons of any type (regular, menu, check, radio) can be created inside this widget. You can also create Label, Entry and LabEntry widgets. Moreover, the ToolBar itself can be made dockable, such that it can be dragged to any edge of your window. Dragging is done in "real-time" so that you can see the contents of your ToolBar as you are dragging it. Furthermore, if you are close to a stickable edge, a visual indicator will show up along that edge to guide you.
ToolBars can be made "floatable" such that if they are dragged beyond their associated window, they will detach and float on the desktop. Also, multiple ToolBars are embeddable inside each other.
If you drag a ToolBar to within 15 pixels of an edge, it will stick to that edge. If the ToolBar is further than 15 pixels away from an edge and still inside the window, but you release it over another ToolBar widget, then it will be embedded inside the second ToolBar. You can "un-embed" an embedded ToolBar simply by dragging it out. You can change the 15 pixel limit using the -close option.
Various icons are built into the Tk::ToolBar widget. Those icons can be used as images for ToolButtons (see "SYNOPSIS"). A demo program is bundled with the module that should be available under the 'User Contributed Demonstrations' when you run the widget program. Run it to see a list of the available images.
Tk::ToolBar attempts to use Tk::CursorControl if it's already installed on the system. You can further control this using the -cursorcontrol option. See "PREREQUISITES".
The ToolBar is supposed to be created as a child of a Toplevel (MainWindow is a Toplevel widget) or a Frame. You are free to experiment otherwise, but expect the unexpected.
Tk::ToolBar 0.09 search tags