vortmax has asked for the wisdom of the Perl Monks concerning the following question:
my $table = $MainFrame-> MListbox( -selectmode => 'single', -columns=>[ [-text=>'Date', -sortable=>1, + -width => 0], [-text=>'Time', -sortable=>1, + -width => 0], [-text=>'Name', -sortable=>1, + -width => 0], [-text=>'Address', -sortable=>1, + -width => 0], [-text=>'Phone', -sortable=>1, + -width => 0] ] )->pack(-fill=> 'both' +, -expand =>1, -side=>'left', -ipadx => 5);; while($result->fetch()){ ### Results from DB query $table->insert('end', [$Date, $Time, $Name, $Address, $Phone]); } my $scroll = $MainFrame->Scrollbar(-command => ['yview', $table]); table->configure(-yscrollcommand => ['set', $scroll]); $scroll->pack(-side => 'right', -fill => 'y');
When you attempt to scroll you get:error:Not a CODE reference at C:/Perl/site/lib/Tk/MListbox.pm line 72 +3. Tk::Error: Not a CODE reference at C:/Perl/site/lib/Tk/MListbox.pm lin +e 723. Tk::Widget::Callback at C:/Perl/site/lib/Tk/Widget.pm line 1149 Tk::CListbox::yview at C:/Perl/site/lib/Tk/MListbox.pm line 66 Tk::Derived::Delegate at C:/Perl/site/lib/Tk/Derived.pm line 463 Tk::Widget::__ANON__ at C:/Perl/site/lib/Tk/Widget.pm line 322 Tk::MListbox::yscrollCallback at C:/Perl/site/lib/Tk/MListbox.pm line + 700 <Configure> (command bound to event)
If you replace the MListbox with a normal listbox, it works just fine.error:Not a CODE reference at C:/Perl/site/lib/Tk/MListbox.pm line 720 +. error:Not a CODE reference at C:/Perl/site/lib/Tk/MListbox.pm line 72 +0. Tk::Error: Not a CODE reference at C:/Perl/site/lib/Tk/MListbox.pm lin +e 720. Tk::Widget::Callback at C:/Perl/site/lib/Tk/Widget.pm line 1149 Tk::CListbox::yview at C:/Perl/site/lib/Tk/MListbox.pm line 66 Tk::Derived::Delegate at C:/Perl/site/lib/Tk/Derived.pm line 469 Tk::Widget::__ANON__ at C:/Perl/site/lib/Tk/Widget.pm line 322 Tk::MListbox::yview at C:/Perl/site/lib/Tk/MListbox.pm line 911 Tk::Scrollbar::ScrlByUnits at ..\blib\lib\Tk\Scrollbar.pm (autosplit +into ..\blib\lib\auto\Tk\Scrollbar\ScrlByUnits.al) line 336 Tk::Scrollbar::Select at ..\blib\lib\Tk\Scrollbar.pm (autosplit into +..\blib\lib\auto\Tk\Scrollbar\Select.al) line 201 Tk::Scrollbar::ButtonDown at ..\blib\lib\Tk\Scrollbar.pm (autosplit i +nto ..\blib\lib\auto\Tk\Scrollbar\ButtonDown.al) line 159 <Button-1> (command bound to event)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: scrolling MListbox in Perl/tk
by zentara (Cardinal) on Jul 16, 2008 at 19:13 UTC | |
by vortmax (Acolyte) on Jul 16, 2008 at 19:40 UTC | |
by zentara (Cardinal) on Jul 16, 2008 at 20:00 UTC | |
by vortmax (Acolyte) on Jul 16, 2008 at 20:12 UTC | |
by Anonymous Monk on Sep 02, 2008 at 22:08 UTC | |
by zentara (Cardinal) on Sep 03, 2008 at 12:54 UTC | |
|