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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.