Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

its click both button will be execute?

by virudinesh (Acolyte)
on Apr 29, 2013 at 12:02 UTC ( #1031200=perlquestion: print w/ replies, xml ) Need Help??
virudinesh has asked for the wisdom of the Perl Monks concerning the following question:

use Tk; my $mw = new MainWindow(-background=>'Gray'); $mw->geometry("1400x800"); $mw ->optionAdd('*background','Gray'); $wb[0] = $mw->Radiobutton( -variable => \$f, -command => \&toclink, -text => 'TOC LINK', -font => "r18", -width => 17, -foreground => 'black', -value => 1)->pack(-side=> 'top',-anchor=>'w',)->place(-relx =>0.0 +,-rely =>0.20); $wb[1] = $mw->Radiobutton( -variable => \$chap_c, -command => \&chapterlink, -text => 'CHAPTER LINK', -font => "r18", -width => 17, -foreground => 'black', -value => 1)->pack(-side=> 'top',-anchor=>'w',)->place(-relx =>0.0 +15,-rely =>0.25); $wb[2] = $mw->Radiobutton( -variable => \$file, -command => sub {$flag =3;}, -text => 'FIGURE LINK', -font => "r18", -width => 17, -foreground => 'black', -value => 'FIGURE LINK')->pack( -side => 'top', -anchor => 'w',)->place(-relx =>0.007, -rely =>0.30); MainLoop(); sub toclink() { $frm_name = $mw -> Frame(-background => 'DarkGray',-relief => 'sunken' +)->pack(-ipadx => 330,-ipady =>0, -side => "right", -fill => "y"); $frm_name->Label(-text =>"Do You Want Give Input Styles: ",-font => 'V +erdana 10 bold',-foreground => 'dark red',-background => 'DarkGray', +-height => 1,-width =>28) -> pack( )->place( -relx =>0.02, -rely =>0.08); $frm_name->Button(-foreground => 'dark red',-text => "yes",-font => ' +Verdana 8 bold', -height => 1,-width => 10,-background => 'DarkGray', +-command => \&enable) -> pack ( )->place( -relx =>0.43, -rely =>0.08); $frm_name->Button(-foreground => 'dark red',-text => "No",-font => 'V +erdana 8 bold', -height => 1,-width => 10,-background => 'DarkGray',- +command => \&disable) -> pack ( )->place( -relx =>0.57, -rely =>0.08); } sub chapterlink() { $frme_window = $mw -> Frame(-background => 'DarkGray',-relief => 'sun +ken')->pack(-ipadx => 330,-ipady =>0, -side => "right", -fill => "y") +; $butn =$frme_window->Label(-text =>'CHAPTER LINK ',-font => 'Verdana +15 bold',-foreground => 'dark red', -background => 'DarkGray',-heigh +t => 1,-width =>23) -> pack( )->place( -relx =>0.3, -rely =>0.1); $labl = $frme_window->Label(-text =>"Chapter Files ",-font => 'Verdana + 10 bold',-foreground => 'dark red',-background => 'DarkGray',-heigh +t => 1,-width =>15) -> pack( )->place( -relx =>0.01, -rely =>0.30); $path_text6 = $frme_window->Entry(-textvariable => \$def_path1,-font = +> 'Verdana 8 bold',-width => 35,-background =>'white')->pack(-expand +=> 1)->place(-relx => 0.20, -rely => 0.3); $path_butn1 = $frme_window->Button(-foreground => 'dark red',-text = +> "Browse",-font => 'Verdana 8 bold', -height => 1,-width => 10,-comm +and => \&browsecl) -> pack ( )->place( -relx =>0.65, -rely =>0.3); $path_buttn2 = $frme_window->Button(-foreground => 'dark red',-text +=> "Submit",-font => 'Verdana 8 bold', -height => 1,-width => 10,-com +mand => \&submitcl) -> pack ( )->place( -relx =>0.80, -rely =>0.3); }
OUTPUT: if click toc button .. toc only execute, then click chaptar link means this sub only execute.. if any know the answer tel me....???

Comment on its click both button will be execute?
Download Code
Re: its click both button will be execute?
by Random_Walk (Parson) on Apr 29, 2013 at 12:43 UTC

    Please edit this to use <code>Some code</code> tags around your code. Then we will be able to read it without getting headaches. It does look like you have tried as I can see a <code> tag at the start of your post. But something is not right.

    Update

    I do suspect these two lines may be related to your trouble.

    $wb[0] = ...; $wb2 = ...;

    I would also add use strict; use warnings; and follow the recomendations it spits out at you.

    Cheers,
    R.

    Pereant, qui ante nos nostra dixerunt!
Re: its click both button will be execute?
by hdb (Parson) on Apr 29, 2013 at 13:30 UTC

    • In each of the radio buttons you need to link to the same variable.
    • The -value paramater needs to be set to a different value.
    • This is the value that your variable is set to when clicking the button.
    • You should probably have the same command associated with each button that looks at the variable and does something different depending on its value.
    • When you click a radio button you first need to delete the Frame created by another button.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1031200]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2014-07-11 00:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (217 votes), past polls