Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: TK Submenus

by PilotinControl (Monk)
on Oct 28, 2013 at 15:54 UTC ( #1060007=note: print w/ replies, xml ) Need Help??


in reply to Re: TK Submenus
in thread TK Submenus

Hello HDB here is the sub routine that is the second sub menu that calls the third sub menu:

sub manifest { if ( !Exists( $mm ) ) { my $mm = $mw->Toplevel(); $mm->group($mw); $mm->resizable(0,0); my $mmframe2 = $mm->Frame()->pack( -side => 'right', -fill => 'both', + -anchor, 'e'); my $mmframe = $mm->Frame()->pack( -side => 'left', -fill => 'both', + -anchor, 'w'); $mm->geometry('400x125+0+0'); $mm->title( "Manifest Management Menu" ); my $mmbtn1 = $mmframe->Button( -text, 'Add A Manifest', -command => +sub { &addmanifest; $mm->iconify;})->grid( -row, 0, -column, 0, - +sticky => 'nsew'); $balloon->attach($mmbtn1, -balloonmsg => "Add A Manifest"); my $mmbtn2 = $mmframe->Button( -text, 'Edit A Manifest', -command => + sub { &editmanifest; $mm->iconify;})->grid( -row, 1, -column, 0, +-sticky => 'nsew'); $balloon->attach($mmbtn2, -balloonmsg => "Edit A Manifest"); my $mmbtn3 = $mmframe->Button( -text, 'Delete A Manifest', -command +=> sub { &deletemanifest; $mm->iconify;})->grid( -row, 2, -column, 0 +, -sticky => 'nsew'); $balloon->attach($mmbtn3, -balloonmsg => "Delete A Manifest"); my $mmbtn4 = $mmframe->Button( -text, 'View All Manifests', -command + => sub { &viewallmanifests; $tmm->iconify;})->grid( -row, 3, -column +, 0, -sticky => 'nsew'); $balloon->attach($mmbtn4, -balloonmsg => "View All Manifests"); my $mmbtn5 = $mmframe2->Button( -text, 'View Manifests By Name', -co +mmand => sub { &viewmanifestbyname; $mm->iconify;})->grid( -row, 0, - +column, 3, -sticky => 'nsew'); $balloon->attach($mmbtn5, -balloonmsg => "View Manifests By Name"); my $mmbtn6 = $mmframe2->Button( -text, 'Total Manifest Count', -comma +nd => sub { &totalmanifestcount; $mm->iconify;})->grid( -row, 1, -col +umn, 3, -sticky => 'nsew'); $balloon->attach($mmbtn6, -balloonmsg => "Total Manifest Count"); my $mmbtn7 = $mmframe2->Button( -text, 'Return To Ops Menu', -command + => sub { $mm->withdraw; $opsm->deiconify;})->grid( -row, 2, -column, + 3, -sticky => 'nsew'); $balloon->attach($mmbtn7, -balloonmsg => "Return To Ops Menu"); } else { $mm->deiconify(); $mm->raise(); } } # END MANIFEST MENU


Comment on Re^2: TK Submenus
Download Code
Re^3: TK Submenus
by hdb (Prior) on Oct 28, 2013 at 15:59 UTC

    And where do you declare and assign some value to variable $opsm?

      Hello HDB, $opsm is defined in the code below however the Add Manifest menu does not return to the Ops menu it needs to return to the Manifest Menu:

      sub opsmgt { if ( !Exists( $opsm ) ) { $opsm = $mw->Toplevel(); $opsm->resizable(0,0); my $opsmframe2 = $opsm->Frame()->pack( -side => 'right', -fill => 'bo +th', -anchor, 'e'); my $opsmframe = $opsm->Frame()->pack( -side => 'left', -fill => 'bo +th', -anchor, 'w'); $opsm->geometry('400x125+0+0'); $opsm->title( "Operations Management Menu" ); my $opsmbtn1 = $opsmframe->Button( -text, 'List Creator', -command = +> sub { &listcreator; $opsm->iconify;})->grid( -row, 0, -column, +0, -sticky => 'nsew'); $balloon->attach($opsmbtn1, -balloonmsg => "List Creator"); my $opsmbtn2 = $opsmframe->Button( -text, 'Waybill Generator', -comm +and => sub { &waybillgenerator; $opsm->iconify;})->grid( -row, 1, +-column, 0, -sticky => 'nsew'); $balloon->attach($opsmbtn2, -balloonmsg => "Waybill Generator"); my $opsmbtn3 = $opsmframe->Button( -text, 'Material Order Creator', +-command => sub { &materialordercreator; $opsm->iconify;})->grid( -r +ow, 2, -column, 0, -sticky => 'nsew'); $balloon->attach($opsmbtn3, -balloonmsg => "Material Order Creator"); my $opsmbtn4 = $opsmframe->Button( -text, 'Truck Scheduler', -comman +d => sub { &truckscheduler; $opsm->iconify;})->grid( -row, 3, -column +, 0, -sticky => 'nsew'); $balloon->attach($opsmbtn4, -balloonmsg => "Truck Scheduler"); my $opsmbtn5 = $opsmframe2->Button( -text, 'Trailer Manifest', -comm +and => sub { &manifest; $opsm->iconify;})->grid( -row, 0, -column, 3, + -sticky => 'nsew'); $balloon->attach($opsmbtn5, -balloonmsg => "Trailer Manifest"); my $opsmbtn6 = $opsmframe2->Button( -text, 'Routes', -command => sub +{ &routes; $opsm->iconify;})->grid( -row, 1, -column, 3, -sticky => ' +nsew'); $balloon->attach($opsmbtn6, -balloonmsg => "Routes"); my $opsmbtn7 = $opsmframe2->Button( -text, 'Truck Hostler')->grid( -r +ow, 2, -column, 3, -sticky => 'nsew'); $balloon->attach($opsmbtn7, -balloonmsg => "Truck Hostler"); my $opsmbtn8 = $opsmframe2->Button( -text, 'Return To Main Menu', -co +mmand => sub { $opsm->withdraw; $mw->deiconify; $btn7->configure(-state=>'normal'), $btn10->configure(-state=>'normal' +) ;})->grid( -row, 3, -column, 3, -sticky => 'nsew'); $balloon->attach($opsmbtn8, -balloonmsg => "Return To Main Menu"); } else { $opsm->deiconify(); $opsm->raise(); } } # END OPERATIONS

        You still have not shown where you declare $opsm. It would be useful to see how that line looks like: my $opsm; or similar. Also in which order do you declare and call the functions you have provided so far.

        In addition I have two question to this snippet:

        if ( !Exists( $mm ) ) { my $mm = $mw->Toplevel(); ...

        Is Exists a Tk specific function (because of the capital E)? You declare a new variable $mm just after testing it in the line before. Is this intentional?

        Apologies for asking one question after the other but I still have no clear picture what is going on...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2015-07-07 16:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (91 votes), past polls