Michael Krause
and 1 contributors


Tk::Statusbox - A recolorable status area (box) that also can flash


    use Tk;
    use Tk::Statusbox

    my $mycolor = 'red';
    my $mw = MainWindow->new();

    my $stbox = $mw->Statusbox(
        -variable       => \$mycolor,
        -command        => \&status_changed_cb,
        -flashintervall => '100',  # time in msecs
        -height         => '30',
        -width          => '50',
        #-relief        => 'sunken',
        #-bg            => 'blue',      

    sub test_cb
        print "status_changed_cb called with [@_], \$mycolor = >$mycolor<\n";
        $mycolor = 'orange';


A cavas/frame style widget that uses a recolorable indicator box with configurable flashing. Useful as an indicator field for common status operations, suitable for perl Tk800.x (developed with Tk800.024).

You can tie a scalar-value to the Statusbox widget, immediate recolor it with '-color' option, assign a callback, that is invoked each time the Statusbox' color is changed, resize it with '-height' and '-width', as well as set the flashintervall with '-flashintervall' and configure any of the options understood by Tk::Frame(s) like -relief, -bg, ... .



'color()' setup a new color in the status area


'flash('START')' starts flashing the status area by swapping the current color in the status area with the normal background color (the one restorable with the clear() method).


'flash('END')' stops flashing the status area and restores the normal background color (the one set with the clear() method).


'clear()' restores the normal background color in the status area (either the apps-background color or the widget's)



'-variable' allows to specify a reference to a scalar-value. Each time the widget changes by user interaction, the variable is changed too. Every variable change is immediately mapped in the widget too.


'-command' can be used to supply a callback for processing after each change of the Checkbox value.


'-flashintervall' can be used to set the flash-timing (on/offtime) in msecs.


'-height' sets the height of the status area widget in pixels.


'-width' sets the width of the status area widget in pixels.


Michael Krause, KrauseM_AT_gmx_DOT_net

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

V1.0 (C) October 2002