Button state controlled by radiobuttons 
Author Message
 Button state controlled by radiobuttons

Hello,

In a TopLevel, I launch a step of configuration via a button:

my $which_var=$displayallFrame->Button(-text => 'Which variables?',
                                       -command =>
sub{setup_variables($gc_simulation->{"display_variables"})},
                                       )->pack(-side => 'bottom');

Since the configuration is necessary only when a variable,
$gc_simulation->{"general_config"}->{"DisplayAllLevels"}, which is
controlled by the user, is false, I put the following two radiobuttons:

$displayallFrame->Radiobutton(-text => 'yes',
                              -value => '1',
                              -command => sub{$which_var->configure(-state => 'disabled')},
                              -variable =>
\$gc_simulation->{"general_config"}->{"DisplayAllLevels"},
                              )->pack(-side => 'left');
$displayallFrame->Radiobutton(-text => 'no',
                              -value => '0',
                              -command => sub{$which_var->configure(-state => 'normal')},
                              -variable =>
\$gc_simulation->{"general_config"}->{"DisplayAllLevels"},
                              )->pack(-side => 'right');

Therefore if I change the state of the radiobuttons, I change the state
of my button. However, when I launch the TopLevel, the button does not
know the state of the radiobuttons. What is the correct way to bind
the state of the button to the values of my radiobuttons?

Thanks very much,

--
Dr Nicolas Le Novre
Dpt of Zoology, Univ of Cambridge, Downing street, Cambridge CB2 3EJ, UK
http://www.*-*-*.com/



Mon, 03 Feb 2003 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. State of Buttons

2. manipulating a buttons state

3. Control CAPSLOCK state?

4. Hide control buttons

5. New bies quest

6. New bies quest

7. Moving from state to state (newbie question)

8. menu adds for checkbuttons or radiobuttons fail.

9. Radiobuttons - problem selecting them

10. Radiobuttons - problem selecting them

11. problems with scrollbars and radiobuttons

12. radiobuttons misbehaving -- deselect/select

 

 
Powered by phpBB® Forum Software