Xiaoyu has asked for the wisdom of the Perl Monks concerning the following question:
The following pieces of code demonstrates my problem.
I have two cascades that contain radiobuttons under the Preference menubutton.
When I select a radiobutton, say option 1 under Cascade1, there will be a check mark beside option 1 all right. The problem is: if I continue to select another radiobutton that is located under Cascade2, say option A, I will have a new check mark beside A but the first check mark beside 1 under Cascade1 will be gone at the same time. How do I fix this problem?Thanks
use strict; use warnings; use Tk; use subs qw/menubar_etal/; my $mw = MainWindow->new; $mw->configure(-menu => my $menubar = $mw->Menu(-menuitems => menubar_ +etal)); MainLoop; sub menubar_etal { [ map ['cascade', $_->[0], -menuitems => $_->[1]], ['~Preference', [ [qw/cascade Cascade1 -tearoff 0 -menuitems/ => [ map ['radiobutton', $_],qw/1 2 3 4/, + ], ], [qw/cascade Cascade2 -tearoff 0 -menuitems/ => [ map ['radiobutton', $_],qw/A B C D/, + ], ], ], ], ]; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I select a Tk menu radiobutton without deselecting another?
by keszler (Priest) on Oct 11, 2011 at 04:25 UTC | |
by Xiaoyu (Initiate) on Oct 11, 2011 at 04:34 UTC |