Like Marshall said, it's a LOT easier to give you help if you provide a complete runnable example of a script demonstrating the problem you are having.
There appears to be two separate problems. First, the pane doesn't seem to get scroll wheel events bound correctly. (Tk::Chart overriding / grabbing them perhaps?) Second, even if the scroll events are bound correctly, if the pane doesn't have focus, it won't receive them.
A kind of hacky fix is to bind the scroll wheel yourself, then make sure anything that grabs focus, releases it to the pane when done.
Add the following lines to the end of your create_mw{} sub:
####################################### bindmousewheel($pane); $pane->focus; for ($datebegin, $dateend, $buttonok) { $_->bind('<Leave>', sub {$pane->focus} ); } #######################################
and add the following bindmousewheel{} sub to your script:
####################################### sub bindmousewheel { my ($w) = @_; if ($^O =~ /Win32/) { $w->bind( '<MouseWheel>' => [ sub { $w->yview( 'scroll', -( $_[1] / 120 ) * 3, 'units' + ); }, Ev('D') ] ); } else { $w->bind( '<4>' => sub { $w->yview( 'scroll', -3, 'units' ) unless $Tk::strictM +otif; } ); $w->bind( '<5>' => sub { $w->yview( 'scroll', +3, 'units' ) unless $Tk::strictM +otif; } ); } } #######################################
With those changes it works for me. (Or at least how I would expect.) Activeperl 5.10.1, WinXP, YMMV
Update: you may need to override the scroll wheel binding for the individual charts and rebind to the pane. I didn't have to with the test script I used, but your circumstances might be different.
In reply to Re: Stop mouse wheel from moving charts up/down Tk::Scrolled
by thundergnat
in thread Stop mouse wheel from moving charts up/down Tk::Scrolled
by pashanoid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |