Monks, *huff* *pant* *wheeze*

I have a problem that is driving me insane. I have a Tk::Listbox that I'm passing around to different routines. These routines call

$widget->configure(-height=>X, -width=>Y);
This works. It reconfigures the height and width properly. I can configure it pack it, packForget it, reconfigure it and repack it, and it works when calling it inside the same sub.
#Create a scrolled listbox $list->configure(-height=>12, -width =>12); #Populate the scrolled listbox with tape numbers $list->insert('end',$_) for @tapes; $list->pack(); + $list->packForget(); $list->configure(-height=>12, -width =>100); $list->pack();
(i.e. I thought it might be once its packed once those options can't be changed). After each subroutine uses the list I call this routine.
sub initList { my $list = shift; #Remove the list from the packing order $list->packForget(); #Remove all elements from the list $list->delete('end') for(0..$list->size); print $list->cget('height'); #Reset heigth and width $list->configure(-height=>1, -width =>1); #Unbind the double click binding $list->bind('<Double-1>',''); return; }
So that the next sub that uses it must configure it the way it likes or be stuck with default values. When my next sub gets the reference passed to it like so,
sub listData { my ($client,$dbh,$dlg,$list) = @_; #retrieve a list of tapeID numbers for a client my @tapes = getTapes($client,$dbh); #Create a DialogBox $dlg->configure(-title=>"Tapes for ".$$client); $dlg->Subwidget('B_1')->configure(-text=>'OK'); $dlg->Subwidget('B_0')->packForget(); #Create a scrolled listbox $list->configure(-height=>12, -width =>12); #Populate the scrolled listbox with tape numbers $list->insert('end',$_) for @tapes; $list->pack(); + #Show the dialog $dlg->Show(); initDialog($dlg); initList($list); return; }
The size of the listbox is not 12 and 12 (although cget'ing the widget says its 12) The size displayed on screen is still the 20x30 that was configured in the subroutine before hand.

Conversely, if I call this routine first and set it to 12 and 12, the routine that attempts to configure the listbox at 20x30 still shows it at 12x12, and cget'ing those options says 20 and 30

What is going on Monks? Any help?

Grygonos

In reply to Tk configure problem by Grygonos

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.