cmv has asked for the wisdom of the Perl Monks concerning the following question:
I want to add (maybe delete) some items from the default menu that comes up when you click <button-3> in a ptk Text window. How can I do this?
The attached code can be used to bring up this default menu. Run the code and right-click-and-hold in the empty text window. You should see a menu containing File, Edit, Search, View.
You'll notice that I'm trying to use bindtags to figure out how this is bound to the text widget by default, but I don't understand the output.
This seems like a very general question that an FAQ should have, but I've failed to find any useful information with my google searches. I got this code from Mastering Perl/Tk (The bindtags Command), but it doesn't seem to be leading in the right direction. Please point me to anything helpful.
Thanks
-Craig
use strict; use warnings; use Tk; # Create new text window... my $top = MainWindow->new(); # Put in the files text box second... my $txt = $top->Text->pack(-expand=>1, -fill=>'both'); foreach my $tag ($txt->bindtags) { print STDERR "$tag has these bindings:\n"; print STDERR $txt->bind($tag), "\n"; } MainLoop();
Update: Changed references from <button-2> to <button-3>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Adding items to default Text widget <button-2> menus?
by Anonymous Monk on Jan 20, 2011 at 18:13 UTC | |
by cmv (Chaplain) on Jan 20, 2011 at 19:15 UTC | |
by Anonymous Monk on Jan 20, 2011 at 19:42 UTC | |
Re: Adding items to default Text widget <button-3> menus?
by Khen1950fx (Canon) on Jan 20, 2011 at 21:05 UTC | |
Re: Adding items to default Text widget <button-3> menus?
by zentara (Archbishop) on Jan 21, 2011 at 13:12 UTC |