in reply to Menu Items & Modules...

It looks like you are expecting each of the sub modules to refer to the same instance of the $view variable, this is not the case. event.pm will have $event::view, and icit_messages will have $icit_messages::view, thus the packForget only gets called locally, and when going from one menu item to the other, the previous contents are not forgotten.

You could either create the $view variable in the main programm, and pass it in to your menu item commands, or instead ask the passed in $top for its children, find out which one is the frame that $view represents, and call packForget on that..

C.

Replies are listed 'Best First'.
Re^2: Menu Items & Modules...
by TonyDonker (Novice) on Feb 21, 2005 at 11:43 UTC
    So in each module I should replace:
    if ($view){ $view->packForget; }
    with:
    ($view) = grep{$_->name eq 'frame'} $$top->children; if ($view){ $view->packForget; }
    ...?
      However: this doesn't work:
      sub messages_function { my $top = shift; @kids = $$top -> children; foreach (@kids) {print "Name: ", $_->name, "\n";} # if ($view) # { # $view->packForget; # } ($view) = grep{substr($_->name, 0, 5) eq 'frame'} $$top->children; if ($view){ $view->packForget; print "icit_messages: "; print $view; print "\n"; } $view = $$top->Frame(qw/-width 400 -height 400 -background white/) +->pack(); }