Ppeoc has asked for the wisdom of the Perl Monks concerning the following question:
No value is returned for $localpath. The code runs fine for just the listbox. But when I start adding radio buttons and text boxes, the code gets messed up. My idea is to have a listbox in the left, radiobuttons on top right and text box on bottom right. Any help will be highly appreciated.sub myListBox{ my @choice1; my $path; my @listbox_items = @_; my $mw = MainWindow->new; $mw->protocol('WM_DELETE_WINDOW',sub{return;}); my $lsb = $mw -> Frame(); $mw->title("Select terms"); my $lb = $mw->Scrolled("Listbox", -scrollbars => "osoe", -height => 200, -width => 400, -selectmode => "multiple", -exportselection =>1)->pack( ); $lb->insert('end', @listbox_items); $lb->pack(-side => "left"); $lb->Button(-text => "Exit", -command => sub{exit; })->pack(-side => "bottom", -fill => 'x'); $mw->Button(-text=>"Select", -command => sub { foreach ($lb->curselection()) { push @choice1, $listbox_items[$_]; } $mw->destroy()}, )->pack(-side => "bottom", -fill => 'x'); my $label = $mw->Label(-text=>"Enter Directory Path:")->pack( ); + my $entry = $mw->Entry()->pack( ); my $localpath = $entry->get(); MainLoop; return @choice1,$localpath; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Listbox, radio buttons and text box in sub function?
by choroba (Cardinal) on Feb 10, 2016 at 13:36 UTC | |
by Ppeoc (Beadle) on Feb 10, 2016 at 18:01 UTC | |
by choroba (Cardinal) on Feb 10, 2016 at 20:12 UTC | |
by Ppeoc (Beadle) on Feb 12, 2016 at 19:54 UTC |