答案 0 :(得分:0)
假设源表名为Table1,则可以使用此表(在高级编辑器中):
#!/usr/bin/perl
use strict;
use warnings;
use Tk;
my $mainWindow = new MainWindow;
my $lb = $mainWindow->Scrolled("Listbox", -scrollbars => "osoe")->pack;
$lb->insert('end', qw/red blue yellow green orange/);
$lb->insert('end', qw/red blue yellow green orange/);
$lb->insert('end', qw/red blue yellow green orange/);
$lb->insert('end', qw/red blue yellow green orange/);
$lb->insert('end', qw/red blue yellow green orange/);
my $lbCanScroll = 0;
$mainWindow->bind('<MouseWheel>' => [sub{ if($lbCanScroll) { $lb->yview('scroll', -($_[1] / 120) * 3, 'units'); } }, Ev('D')]);
$lb->bind('<Leave>' => sub{$lbCanScroll = 0});
$lb->bind('<Enter>' => sub{$lbCanScroll = 1});
MainLoop;