After becoming the proud new owner of a Logitech Optical Wheel USB/PS2 mouse (which BTW installed beautifully on RH 7.1 Linux) I began exploring ways to add wheel scroll support to my favorite apps which don't support the wheel directly.

Two those apps are Shendai's Tk Monkchat and Tk Newest Nodes.

Monkchat worked perfectly with just the addition of 4 lines of code.

# ## from monkchat.pl # # chatfield $Chatfield = $lframe->Scrolled("ROText", -font => $pgmfont, -width => 20, -height => 2, -bg => $options{'background'}, -wrap => 'word', -relief => 'sunken', -scrollbars => 'osoe', )->pack(-side => 'top', -fill => 'both', -expand => 1); # ## Added 09/09/2001 MitD -- wheel mouse support # $Chatfield->bind("<Button-4>", sub { $Chatfield->yviewScroll(1,"un +its") }); $Chatfield->bind("<Button-5>", sub { $Chatfield->yviewScroll(-1,"u +nits") }); ... $Userlist->bind("<Button-4>", sub { $Userlist->yviewScroll(1,"unit +s") }); $Userlist->bind("<Button-5>", sub { $Userlist->yviewScroll(-1,"uni +ts") });

Unfortunatly Tk Newest Node has proven to be move difficult.

# ## from pmnewnodes.pl # $tree = $uframe->Scrolled("Tree", -width => 80, -height => 5, -background => "$options{background}", -selectbackground => "$options{background}", -itemtype => 'text', -separator => '.', -selectmode => 'single', -relief => 'sunken', -scrollbars => 'osoe', -command => \&command, )->pack(-side => 'top', -fill => 'both', -expand => 1); # ## Added 09/09/2001 MitD -- This code DOES NOT WORK # # $tree->bind("<Button-4>", sub { $tree->yviewScroll(1,"units") }); # $tree->bind("<Button-5>", sub { $tree->yviewScroll(-1,"units") }); #
Tk::Tree does not seem to be supported the same way as other Scrollable widgets (or in Tk Terminalogy Scrolled Widgets).

You can see in the above code that both Monk chat's ROText object and Newest Nodes Tree object are constructed in the same way but when $tree->yviewScroll(... is invoked the method cannot be found for Tk::Tree.

I have looked around Tk::Tree and its parent classes and still come up short.

Any ideas ?? I'll buy beer!

mitd-Made in the Dark
'My favourite colour appears to be grey.'


In reply to Perl/Tk Mouse wheel support by mitd

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.