I have a question and I am sure it is something very small. I am wondering if someone can help me. I am trying to create a Scrolled Listbox (initial width 25) and once options are populated in the Listbox the width of the Listbox will change based on the widest option. I know if you set width to 0 my Listbox will be resized to the widest option (expected behavior), but this is not working :-\

# Create a frame ... my $suite_fr = $page->Frame->pack(-expand => 1, -fill => 'both'); # Add a label to the frame $suite_fr->Label(-text => 'Suite:')->pack(-side => 'left'); # create a Scrolled Listbox $self->{suite_lb} = $suite_fr->Scrolled('Listbox', -exportselection => '0', -width => '25', -height => '7', -scrollbars => 'e', -selectbackground => 'gray80', -selectforeground => 'black', -selectmode => +'extended' )->pack(-side => 'left'); # A user will then click the submit buttom and be redirected to anothe +r method with the code listed below .. # Populate the ListBox with the valid suites $self->{suite_lb}->insert(0, @list); # Retrieve the Listbox subwidget that is part of Scrolled my $lb_subwidget = $self->{suite_lb}->Subwidget("listbox"); # Change the size of the Listbox $lb_subwidget->configure(-width => '0');

However, this does not work. If I create a plan Listbox then I can resize it using configure() but, there is something different about using the Scrolled method that is different. Please help !


In reply to Problem setting width on Scrolled Listbox by pirishmonk

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.