Figured it out..
in case anyone was wondering...
sub OnSetNodeDialog {
# Construct the DialogBox
my $setNode = $mw->DialogBox( -title=>"Set Node Dialog", -default_button
=> "Cancel", -buttons=>["OK", "Cancel"] );
# Now we need to add a Label widget so we can show some text
$setNode->add('Label', -anchor => 'w', -justify => 'left', -text =>
qq(Choose Node to search on.\n\tCurrent Node = $nodesrch ))->pack;
$setNode->Label(-text => 'Search on Node')->pack;
my $org_value = $nodesrch;
my $rb2_value = $nodesrch;
my $answer2 = "";
my $rb2_valueA = node-ex';
my $rb2_valueB = 'edwdev';
# my $rb2_value = node-ex';
$setNode->Radiobutton(-text => node-ex', -value => "node-ex"
, -variable => \$rb2_value, -command => sub {OnSetNode("node-ex"); })->pack;
$setNode->Radiobutton(-text => 'edwdev', -value => "edwdev", -variable
=> \$rb2_value, -command => sub {OnSetNode( "edwdev"); } )->pack;
$answer2 = $setNode->Show();
if ($answer2 eq 'OK') {
# ... nothing to do, accept the change...
} else {
# ... revert back to previous value ...
$nodesrch = $org_value;
}
}
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello all..
> the radiobuttons execute the code in the command whether I select OK or
> Cancel.. How can I execute on ok only?
>
> I have the following code:
> sub OnPowerSearchDialog {
> # Construct the DialogBox
> my $setpwrsrch = $mw->DialogBox( -title=>"Set Node
> Dialog", -buttons=>["OK", "Cancel"] );
> $setpwrsrch->add('Label', -anchor => 'w', -justify => 'left', -text =>
> qq(Choose Node to search on.\n\tCurrent Node = $pwrsrch ))->pack;
> $setpwrsrch->Label(-text => 'Search on Node')->pack;
> my $rb3_value = $pwrsrch ;
> $setpwrsrch->Radiobutton(-text => 'NO', -value => "NO" , -variable
=>
> \$rb3_value, -command => sub {OnPowerSearch("NO"); })->pack;
> $setpwrsrch->Radiobutton(-text => 'YES', -value => "YES", -variable
=>
> \$rb3_value, -command => sub {OnPowerSearch("YES"); } )->pack;
> $setpwrsrch->Show();
> }
>
> sub OnPowerSearch {
> # set the power search variable
> $pwrsrch = $_[0] ;
> }
>
>
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>