#!./perl
BEGIN { push(@INC, qw(../../../lib ../../lib ../lib lib)) }
use Tk;

$top = tkinit;
$foo = "two";
$b = Button::new($top, "-text"   => "print value", "-method" => "::printit");
$l = Label::new($top, "-text" => "set value");

tkbind($l, "<1>", "setit", "one");
tkbind($l, "<2>", "setit", "two");
tkbind($l, "<3>", "setit", "three");

tkpack $b, $l;
foreach ("one", "two", "three") {
    $r = Radiobutton::new($top, "-text"     => $_,
                                "-variable" => $foo,
                                "-value"    => $_);
    tkpack $r, "-side" => "top", "-fill" => "x";
}
tkmainloop;

sub printit {
    print "Current value is $foo\n";
}
sub setit {
    local($value) = @_;
    print "Setting to $value\n";
    $foo = $value;
}
