The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

SYNOPSIS

    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',      
    )->pack;

        
    Tk::MainLoop;
        
    sub test_cb
    {
        print "status_changed_cb called with [@_], \$mycolor = >$mycolor<\n";
        #$stbox->color('red');
        $mycolor = 'orange';
    }
        

DESCRIPTION

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, ... .

METHODS

color()

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

flash('START')

'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')

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

clear()

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

OPTIONS

-variable

'-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

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

-flashintervall

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

-height

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

-width

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

AUTHORS

Michael Krause, KrauseM_AT_gmx_DOT_net

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

V1.0 (C) October 2002