in reply to Perl Tk issue with mouse wheel scrolling

This works, just remove 'all' from your bind, as suggested above. Also, Scrolled Frames are not recommended, use a Scrolled Pane.
#!/usr/bin/perl use Tk; use Tk::BrowseEntry; use Tk::Pane; use strict; my ($mw,$topframe,$font,$row,$i,$who); my (@frame,@list,@label); my (%var); $mw = MainWindow->new(); $mw->geometry('1000x300+400+40'); $mw->title("Test GUI"); $mw->bind('<KeyPress-Return>', sub{shift->focusNext}); $topframe = $mw->Scrolled('Pane', -scrollbars => 'e',-height => 1000)- +>pack(); #$mw->bind('all','<4>',=>sub{$topframe->yview('scroll',3,'units')}); #$mw->bind('all','<5>',=>sub{$topframe->yview('scroll',3,'units')}); $mw->bind('<4>',=>sub{$topframe->yview('scroll',3,'units')}); $mw->bind('<5>',=>sub{$topframe->yview('scroll',3,'units')}); $font = "-adobe-times-bold-r-normal--20-100-75-75-p-p-56-iso8859-1"; $row = 1; for ($i =0; $i < 100; $i++) { $frame[$i] = $topframe->Frame(-borderwidth => '1', -relief => +'groove'); $list[$i] = $frame[$i]->BrowseEntry(-variable => \$var{$i}, -takefocus => 0, -foreground => 'black', -disabledforeground => 'black', -highlightcolor => 'green', -font => $font, -width => 50, -state => 'readonly') ->pack(-side => "left", +-padx => "5"); $label[$i] = $frame[$i]->Label(-text => $i, -anchor => 'w', -takefocus => 0, -foreground => 'black', -font => $font, -width => 50, -height => 1) ->pack(-side => "right", -padx +=> 5); $frame[$i]->grid(-row => ++$row, -column => 1, -sticky => 'e', + -padx => 5); $list[$i]->insert('end', (1..100)); } MainLoop();

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: Perl Tk issue with mouse wheel scrolling
by Anonymous Monk on Aug 02, 2014 at 15:42 UTC
    Thank you all very much for the help!!!!