pirishmonk has asked for the wisdom of the Perl Monks concerning the following question:
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 !
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem setting width on Scrolled Listbox
by thundergnat (Deacon) on May 26, 2010 at 15:26 UTC | |
|
Re: Problem setting width on Scrolled Listbox
by amedico (Sexton) on May 26, 2010 at 14:41 UTC |