Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^4: TK Submenus

by PilotinControl (Pilgrim)
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

Replies are listed 'Best First'.
Re^5: TK Submenus
by hdb (Monsignor) 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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1060009]
[Corion]: A good weekstart to everybody!

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2018-06-18 08:14 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (109 votes). Check out past polls.