That sounds reasonable, but I can't figure out how to use entryconfigure to add child commands under the top level menu entry. If you can show me or point to a minmal working example it would be a huge help.

Update: AHA! It turns out that entryconfigure IS usable to do what I am trying to do, it is just that the syntax of the command is quite arcane. I pieced this together from bits found in several places. Many thanks to spurperl for steering me in the right direction.

#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::Text; my $top = MainWindow->new; my $text = $top->Text->pack(-expand => 'yes', -fill => 'both'); my $menu = $text->menu; add_my_menu_item($menu, 2, 'bogus', $text); $top->configure(-menu => $menu); MainLoop; sub add_my_menu_item{ my ($menu, $index, $name, $widget) = @_; $menu->insert($index, 'cascade', -label => $name, -menu => $menu-> +entrycget($index, '-menu')->Menu( -tearoff => 0 )); my $entry = $menu->entrycget($index, '-menu'); map ( $entry->command ( -label => $_, -command => [sub {$widget->insert('insert', $_[0])}, $ +_], ) ,(qw/1 2 3 4 5/) ); }

In reply to Re^4: $menu->insert problem in Perl/Tk by thundergnat
in thread $menu->insert problem in Perl/Tk by thundergnat

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.