| Rainer Jung 2004-04-29, 6:47 am |
| Hello, Group.
I want to change the name of an Menubutton on Selection of the
submenu.
Here's a bit of code:
my $Menu = $MainWindow
-> Menubutton ( -text => 'Station' )
-> pack ( -side => 'right' );
my $Stations = { 1 => 'ARD', 2 => 'ZDF', 3 => 'Sat.1' };
my $Station;
foreach(keys %$Stations) {
$Menu -> radiobutton (
-label => $Stations->{$_},
-command \&switchStation,
-variable => \$Station,
-value => $_ );
}
sub switchStation {
...
}
Now, can someone tell me, how i can change the Text ('Station') from
the Menubutton to the selected Station-Name (f.e. 'ARD' or 'ZDF')
inside the switchStation procedure?
I Tried:
$Menu -> entryconfigure( -label => $Stations->{$Station} );
But got:
Tk::Error: bad menu entry index "-label" at Tk.pm line 228.
Tk callback for .frame.menubutton1.menu
[\&main::switchStation]
(menu invoke)
Thanks, Rainer
|