Cascading Menus in Perl/Tk

Could not remember how to do cascading submenus in Perl/Tk the “old” way and googled examples were very hard to grok, but after an hour+ of t&e, here’s what works:

my $someMenubtn = $frame->Menubutton(
-text => ‘TopMenuItem’, -underline => 0, -takefocus => 1);

$someMenubtn->cascade(-label => ‘Menuitem_x’, -menuitems => [
[Button => ‘Submenuitem_1’, -underline => 12, -command => sub { } ],
[Button => ‘Submenuitem_2’, -underline => 12, -command => sub { } ],

]);

Advertisements

Feel Free to Comment (Name/Email/Website optional):

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: