Jack Dunnigan > Tk-MiniScale > Tk::MiniScale

Download:
Tk-MiniScale-0.1.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.1   Source  

NAME ^

Tk::MiniScale - A miniature scale widget

SYNOPSIS ^

$miniscale = $parent->MiniScale(?options?);

EXAMPLE ^

    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;

SUPER-CLASS ^

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.

By default, all configurations are delegated to the Scale widget.

DESCRIPTION ^

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.

WIDGET-SPECIFIC OPTIONS ^

All options provided by the Scale widget are available. Currently there is only one other option supported.

-sliderside

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.

WIDGET METHODS ^

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.

switchFromTo

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.

ADVERTISED WIDGETS ^

The following widgets are advertised:

canvas

The canvas widget.

scale

The scale widget (which is an embedded window in the canvas)

BUGS ^

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;

TO DO ^

This widget was stripped out of another module I was working on. It will provide a button-invoked popup miniscale. Stay tuned.

AUTHOR ^

Jack Dunnigan dunniganj@cpan.org

syntax highlighting: