|<B>-sideB>||This option tells the ToolBar what edge to initially stick to. Can be one of top, bottom, left or right. Defaults to top. This option can be set only during object creation. Default is top.|
|<B>-movableB>||This option specifies whether the ToolBar is dockable or not. A dockable ToolBar can be dragged around with the mouse to any edge of the window, subject to the sticky constraints defined by -sticky. Default is 1.|
|<B>-closeB>||This option specifies, in pixels, how close we have to drag the ToolBar an edge for the ToolBar to stick to it. Default is 15.|
|<B>-stickyB>||This option specifies which sides the toolbar is allowed to stick to. The value must be a string of the following characters nsew. A string of ns means that the ToolBar can only stick to the north (top) or south (bottom) sides. Defaults to nsew. This option can be set only during object creation.|
|<B>-inB>||This option allows the toolbar to be embedded within another already instantiated Tk::ToolBar object. The value must be a Tk::ToolBar object. This option can be set only during object creation.|
|<B>-floatB>||This option specifies whether the toolbar should float on the desktop if dragged outside of the window. It defaults to 1. Note that this value is ignored if -cursorcontrol is set to 1.|
|<B>-cursorcontrolB>||This option specifies whether to use Tk::CursorControl to confine the cursor during dragging. The value must be either 1 or 0. The default is 1 which checks for Tk::CursorControl and uses it if present.|
|<B>-mystyleB>||This option indicates that you want to control how the ToolBar looks like and not rely on Tk::ToolBars own judgement. The value must be either 1 or 0. For now, the only thing this controls is the relief of ToolButtons and the borderwidth. Defaults to 0.|
|<B>-indicatorcolorB>||This option controls the color of the visual indicator that tells you whether you are close enough to an edge when dragging the ToolBar. Defaults to some shade of blue and green (I like it :P).|
|<B>-indicatorreliefB>||This option controls the relief of the visual indicator that tells you whether you are close enough to an edge when dragging the ToolBar. Defaults to flat.|
The following methods are used to create widgets that are placed inside the ToolBar. Widgets are ordered in the same order they are created, left to right.
$ToolBar-><B>ToolButtonB>(?-type => buttonType,? options) $ToolBar-><B>ButtonB>(?-type => buttonType,? options) This method creates a new Button inside the ToolBar. The -type option can be used to specify what kind of button to create. Can be one of Button, Checkbutton, Menubutton, or Radiobutton. A tooltip message can be specified via the -tip option. An accelerator binding can be specified using the -accelerator option. The value of this option is any legal binding sequence as defined in bind. For example, -accelerator => <f> will invoke the button when the f key is pressed. Any other options will be passed directly to the constructor of the button. The Button object is returned. $ToolBar-><B>ToolLabelB>(options) $ToolBar-><B>LabelB>(options) This method creates a new Label inside the ToolBar. Any options will be passed directly to the constructor of the label. The Label object is returned. $ToolBar-><B>ToolEntryB>(options) $ToolBar-><B>EntryB>(options) This method creates a new Entry inside the ToolBar. A tooltip message can be specified via the -tip option. Any other options will be passed directly to the constructor of the entry. The Entry object is returned. $ToolBar-><B>ToolLabEntryB>(options) $ToolBar-><B>LabEntryB>(options) This method creates a new LabEntry inside the ToolBar. A tooltip message can be specified via the -tip option. Any other options will be passed directly to the constructor of the labentry. The LabEntry object is returned. In horizontal ToolBars, the label of the LabEntry widget will be packed to the left of the entry. On vertical ToolBars, the label will be packed on top of the entry. $ToolBar-><B>ToolOptionmenuB>(options) $ToolBar-><B>OptionmenuB>(options) This method creates a new Optionmenu inside the ToolBar. A tooltip message can be specified via the -tip option. Any other options will be passed directly to the constructor of the Optionmenu. The Optionmenu object is returned. $ToolBar-><B>separatorB>(?-movable => 0/1, -space => num?) This method inserts a separator. Separators are movable by default. To change that, set the -movable option to 0. If you want to add some space to the left of a separator (or at the top if your ToolBar is vertical), then you can specify the amount of space (in pixels) via the -space option. This can be used to right-justify some buttons.
Tk::ToolBar now comes with a set of useful images that can be used in your Tk programs. To view those images, run the <B>widgetB> program that is bundled with Tk, scroll down to the User Contributed Demonstrations, and click on the Tk::ToolBar entry.
Note that the images are created using the text method. Also, Tk::ToolBar, upon its creation, pre-loads all of the bundled images into memory. This means that those images are available for use in other widgets in your Tk program. This also means that unless those images are explicitly destroyed, they will use up a small amount of memory even if you are not using them explicitly.
As far as I know, all the bundled images are in the free domain. If that is not the case, then please let me know.
Not really a bug, but a feature ;-) The ToolBar widget assumes that you use pack in its parent. Actually, it will pack() itself inside its parent. If you are using another geometry manager, then you MIGHT get some weird behaviour. I have tested it very quickly, and found no surprises, but let me know if you do.
Another thing I noticed is that on slower window managers dragging a ToolBar might not go very smoothly, and you can drop the ToolBar midway through dragging it. I noticed this on Solaris 7 and 8, running any of OpenLook, CDE or GNOME2 window managers. I would appreciate any reports on different platforms.
I have implemented everything I wanted, and then some. Here are things that were requested, but are not implemented yet. If you want more, send me requests.
o Allow buttons to be tied to menu items. Somewhat taken care of with the -accelerator method for buttons. o Implement Drag-n-Drop to be able to move Tool* widgets interactively. Do we really want this?
Tk::ToolBar uses only core pTk modules. So you dont need any special prerequisites. But, if Tk::CursorControl is installed on your system, then Tk::ToolBar will use it to confine the cursor to your window when dragging ToolBars (unless you tell it not to).
Note also that Tk::CursorControl is defined as a prerequisite in Makefile.PL. So, during installation you might get a warning saying:
Warning: prerequisite Tk::CursorControl failed to load ...
Either the usual:
perl Makefile.PL make make install
or just stick it somewhere in @INC where perl can find it. Its in pure Perl.
The following people have given me helpful comments and bug reports to keep me busy: Chris Whiting, Jack Dunnigan, Robert Brooks, Peter Lipecka, Martin Thurn and Shahriar Mokhtarzad.
Also thanks to the various artists of the KDE team for creating those great icons, and to Adrian Davis for packaging them in a Tk-friendly format.
Ala Qumsieh firstname.lastname@example.org
This module is distributed under the same terms as Perl itself.
|perl v5.20.3||TOOLBAR (3)||2010-02-27|