Hi,

I am currently building a GUI in which I want to elaborate each menu item in a seperate module. This is a fragment of my main program:

use Tk 800; use Tk::Dialog; use event; use icit_messages; $top = new MainWindow; $top->title("As2Con Gui"); my $frame = $top->Frame(qw/-width 800 -height 300 -background white/)- +>pack; create_gui(); sub create_gui { $menubar = $top->Menu; $status_menu->command(-label => "~Events", -command => sub { even +t_function(\$frame) }); $status_menu->command(-label => "M~essages", -command => sub { m +essages_function(\$frame) }); ....
In module event.pm the function event_function is defined (a fragment):
sub event_function { my $top = shift; if ($view) { $view->packForget } $view = $$top->Frame(qw/-width 800 -height 400 -background whi +te/)->pack(-expand => 1, -fill => 'both'); ...
In module icit_messages.pm the function messages_function is defined (a fragment):
sub messages_function { my $top = shift; if ($view) { $view->packForget; } $view = $$top->Frame(qw/-width 400 -height 400 -background white/)-> +pack(); ...
The problem is when I select menu item Events everything goes OK in the current window, but when I select menu item Messages after I have selected Events the current window is enlarged and the output of Messages is below the output of Events in the same window. This problem does not occur when I select Messages or Events two times after each other...

What am I doing wrong?

Thanks,
Ton

In reply to Menu Items & Modules... by TonyDonker

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.