I must apologize a bit to you. The preferred way to modify a module, for your own use, is to use a Derived widget. But as I experimented with making a Derived Menubutton widget, many unexpected behaviors popped up. I finally resorted to trying a local Tk directory containing a copy of Menubutton.pm . Then even with
use strict;
use lib '.';
BEGIN{ unshift @INC, '.';}
use Tk;
print "@INC\n";
.....
It would find the system installed module, instead of my copy.
I did manage to get a package MyMenuButton to load error free, but the menubutton would not appear in the $mw->menu for some reason.
Here is as far as I care to take it. It works as a package, as long as you place the Derived MenuButton in the $mw, instead of the $mw->menu(). I do not know why it won't work from the menu. I changed the cursor to a pencil. So this would be perfectly acceptable as far as license and distribution goes. You can do some more cursor modifications in the Enter and Leave subs if you desire.
|