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

Re^4: TK Submenus

by PilotinControl (Scribe)
on Oct 28, 2013 at 16:20 UTC ( #1060009=note: print w/ replies, xml ) Need Help??


in reply to Re^3: TK Submenus
in thread TK Submenus

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


Comment on Re^4: TK Submenus
Download Code
Re^5: TK Submenus
by hdb (Prior) on Oct 28, 2013 at 18:00 UTC

    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...

      $opsm, $mm and others are defined at the beginning of the program like this: my ($opsm, $mm, $sbm); I've since removed the If !Exists line and it still has no bearing...scratching my head here as the code is exactly like the previous menus. What should happen is once a Manifest has been added that window disappears which it does and the Manifest menu should reappear which it does not. If I try to call the Ops menu $opsm that works the $mm (Manifest Menu) does not iconify.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2014-10-23 04:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (123 votes), past polls