Tk::MiniScale - A miniature scale widget
$miniscale = $parent->MiniScale(?options?);
use Tk; use Tk::MiniScale; my $mw=tkinit; my $var = 0; $mw->MiniScale( -sliderside=>'bottom', -variable=>\$var, -command=>sub{print "$var\n"}, )->pack(-fill=>'x', -expand=>1); MainLoop;
The MiniScale class is derived from the Frame class. However, this megawidget is comprised of a Canvas containing two items - an bitmap item and an embedded window which houses a real Tk::Scale widget.
MiniScale
Frame
Canvas
By default, all configurations are delegated to the Scale widget.
MiniScale is a smaller version of Tk::Scale which is especially useful when the user doesn't really care about the actual value of the variable they are modifying. In other words - they just want to increase or decrease something by a relative amount. This implies that less precision is needed and therefore less space can be used to draw this widget. i.e. the increment per pixel can be higher than in a normal scale
Some useful examples might include a volume control or color intensity control.
All options provided by the Scale widget are available. Currently there is only one other option supported.
Which side of the scale to place the arrow slider. Must be left, right, top or bottom. The orientation of the scale need not be stated explicitly. A left or right implies a vertical orientation while top or bottom implies a horizontal orientation.
If you wish to use the Tk::Scale methods then you will have to use the Subwidget method to get the advertised scale object. Otherwise currently only one public method exists.
Switch the -from and -to widget options to align at opposite ends of the scale.
Really - you should never have to call this method. I don't even really know why I left it as a public method. Some reasoning follows:
A normal Scale widget oriented in the vertical will default a 0 at the top of the widget and 100 at the bottom. This is undesirable in the miniscale as as moving the slider upward or to the right is assumed to be towards a higher number. By default - the MiniScale will always default to a zero at the bottom and 100 at the top of a vertically oriented widget. Similarly it defaults to a zero at the left and 100 at the right of a horizontally oriented widget.
So I guess if you don't like that then you can use this method to change it back.
The following widgets are advertised:
The canvas widget.
The scale widget (which is an embedded window in the canvas)
None known at this time. Just be aware that this widget is not meant to provide precision. It is mainly used as a percentage increase or decrease to a variable of your choosing.
Also be aware that all the button and keyboard bindings for the Tk::Scale remain intact. Just give focus to the scale if you want the user to have access to the keyboard bindings.
$miniscale->Subwidget('scale')->focus;
This widget was stripped out of another module I was working on. It will provide a button-invoked popup miniscale. Stay tuned.
Jack Dunnigan dunniganj@cpan.org
To install Tk::MiniScale, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tk::MiniScale
CPAN shell
perl -MCPAN -e shell install Tk::MiniScale
For more information on module installation, please visit the detailed CPAN module installation guide.