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.
Tk::Tree does not seem to be supported the same way as other Scrollable widgets (or in Tk Terminalogy Scrolled Widgets).# ## 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") }); #
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |