Results 1 to 1 of 1
Hi All,
I have created a simple perl TK Dialog Box. In this I created a
radiokbutton in order to select either one of the option. If the user
select ...
- 01-14-2008 #1Just Joined!
- Join Date
- Jan 2008
- Location
- Chennai, Tamil Nadu, India
- Posts
- 1
Optional Widget
Hi All,
I have created a simple perl TK Dialog Box. In this I created a
radiokbutton in order to select either one of the option. If the user
select first, I want to display a widget below that to choose some
more option. If user select second, I want to destroy the widget. I
have successfully done this using "Destroy" in the if condition.
But if user going to change their mind and again select the first. It
will not display the widget.
My sample coding is as follows:
use Tk 800.000;
use strict;
use Warnings;
use Win32::GUI;
my $tagVar;
my $TxVar;
my $mw = MainWindow -> new;
my $sel3 = $mw -> Frame -> pack(-anchor => 'w', -padx => '10', -pady
=> '0');
$sel3 -> Label (-text => 'Tags:') -> pack(-side => 'left');
foreach (qw(optional all)) {
$sel3 -> Radiobutton(-text => $_,
-value => $_,
-variable => \$tagVar,
-command => \&set_Tag)->pack(-side => 'left');
}
my $sel4 = $mw -> Frame -> pack(-fill => 'both', -expand => '1', -padx
=> '10', -pady => '0');
MainLoop;
sub set_Tag {
if ($tagVar eq "optional") {
$sel4 -> Checkbutton (-text => 'Text', -variable => \$TxVar) ->
pack(-side => 'left', -fill => 'both', -expand => '1');
}
else {
$sel4->destroy if Tk::Exists($sel4);
}
}
Please anybody help me to solve this problem.
Regards,
Srikrishnan


Reply With Quote