mitd has asked for the wisdom of the Perl Monks concerning the following question:
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.'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl/Tk Mouse wheel support
by Ven'Tatsu (Deacon) on Aug 11, 2001 at 00:03 UTC | |
by mitd (Curate) on Aug 11, 2001 at 03:09 UTC | |
|
OT - Re: Perl/Tk Mouse wheel support
by blakem (Monsignor) on Aug 11, 2001 at 03:02 UTC | |
by redmist (Deacon) on Aug 12, 2001 at 06:28 UTC | |
|
Re: Perl/Tk Mouse wheel support
by Shendal (Hermit) on Aug 13, 2001 at 19:19 UTC | |
by Anonymous Monk on Jul 14, 2022 at 13:03 UTC | |
by Anonymous Monk on Jul 14, 2022 at 17:24 UTC | |
by soonix (Chancellor) on Jul 16, 2022 at 20:12 UTC |