The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tk::Buttonplus - Enhanced Button widget with a bitmap/image AND a text label

SYNOPSIS

    use Tk;
    use Tk::Buttonplus

    my $mw = MainWindow->new();

    my $downangle_data = <<'downangle_EOP';
    /* XPM */
    static char *arrow[] = {
    "14 9 2 1",
    ". c none",
    "X c black",
    "..............",
    "..............",
    ".XXXXXXXXXXXX.",
    "..XXXXXXXXXX..",
    "...XXXXXXXX...",
    "....XXXXXX....",
    ".....XXXX.....",
    "......XX......",
    "..............",
    };
    downangle_EOP

    my $downangle = $mw->Pixmap( -data => $downangle_data);

    my $text = 'bttn-text';
    my $bt1 = $mw->Buttonplus(
        -text => 'Enable',
        #-image => $downangle,
        -bitmap => 'error',
        -command => \&bttn_pressed_cb1,
        #-borderwidth => '12',
        #-relief => 'ridge',
        #-bg => 'orange',
        #-fg => 'green',
        -textvariable => \$text,
        #-side => 'bottom',
        #-activeforeground => 'skyblue',
    )->pack(-padx => 50, -pady => 50);

    my $bt2 = $mw->Button(
            -text => 'Disable',
            -command => [\&bttn_pressed_cb2, $bt1],
            #-image => $downangle,
    )->pack;

        
    Tk::MainLoop;
        
    sub bttn_pressed_cb1
    {
        print "bttn 1 pressed.\n";

    }
    sub bttn_pressed_cb2
    {
        print "bttn 2 pressed.\n";
        $_[0]->configure(-state => ($_[0]->cget('-state') eq 'normal' ? 'disabled' : 'normal'));
    }
        

DESCRIPTION

A Button widget that can be used as a replacement for the standard Button, if you need to display a bitmap/image AND a text label.

METHODS

for details on supported methods - see Tk::Button

OPTIONS

-side

-side => 'value' allows to specify the side at which the bitmap/image is positioned. Value may be one of top, left, bottom or right.

for details on all other options - see Tk::Button

AUTHORS

Michael Krause, KrauseM_AT_gmx_DOT_net

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

V0.2 (C) 2004, - 2007