Monks-

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>


In reply to Adding items to default Text widget <button-3> menus? by cmv

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.