Tk::Checkbox - Yet Another Checkbutton widget


NAME

Tk::Checkbox - Yet Another Checkbutton widget (with a sizable marker)


SYNOPSIS

    use Tk;
    use Tk::Checkbox;
    my $var = 'Up';
    my $mw = MainWindow->new();
    my $cb1 = $mw->Checkbox (
        -variable => \$var,
        -command  => \&test_cb,
        -onvalue  => 'Up',
        -offvalue => 'Down',
        #-noinitialcallback => '1',
                #-size => '8',
   )->pack;
        
    Tk::MainLoop;
        
    sub test_cb
    {
        print "test_cb called with [@_], \$var = >$var<\n";
    }


DESCRIPTION

Another check button style widget that uses a check mark in a fixed box. Useful as a boolean field. It's based on Damion K. Wilson's version from Tk-DKW-0.03, suitable for perl Tk800.x (developed with Tk800.024).

You can tie a scalar-value to the Checkbox widget, enable/disable it, assign a callback, that is invoked each time the Checkbox is changed, as well as set ON- and OFF-values and configure any of the options understood by Tk::Frame(s) like -relief, -bg, ... .


METHODS

set()
'set($newvalue)' allows to set/reset the the widget methodically, $newvalue must be either 'onvalue' or 'offvalue'.

You should prefer interacting with the widget via a variable.


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.

-onvalue
'-onvalue' can be used to supply a value that is used/returned, if the checkmark is 'checked'. default is '1'.

-offvalue
'-offvalue' is the opposite of 'onvalue', it isused/returned, if the checkmark is 'unchecked'. default is '0'.

-noinitialcallback
'-noinitialcallback' can be used to suppress the invocation of an (assigned) callback, immediate after a (new) variable has been configured with -variable.

-size
'-size' can be used to specify the widget- (and checker) size (default 15 pt)


AUTHORS

Michael Krause, KrauseM_AT_gmx_DOT_net

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

V2.8 (C) September 2011

 Tk::Checkbox - Yet Another Checkbutton widget