I am trying to create a cascading menu using Perl TK on a Solaris 9 system using Perl 5.8/Tk. The problem I am having is that all my cascaded menues are popping up. What I would like is to have the submenu's popup only when I click on the menu item. Any ideas??
Note--> I have simplified the below code for easier reading.
thanks
w3ntp
#!/usr/local/bin/perl
# ABSTRACT: Perl Shell script to create menu widgets
#
#
use Tk;
#
# Start the Main program
#
print "Menu Shortcut Server Ver 1.0, working....\n";
$mw = MainWindow -> new;
$mw -> title("NOCMAN Workstation");
$mw -> Frame( -width => 300, -height => 18) -> pack;
$mw -> configure( -menu => my $menubar = $mw -> Menu);
my $file = $menubar -> cascade(-label => '~File');
my $edit = $menubar -> cascade(-label => '~Edit');
$new = $file ->cascade( -label => 'New');
$new ->command( -label => 'new stuff');
$new ->command( -label => 'more stuff');
$new ->command( -label => 'other stuff');
$file ->command( -label => 'Open');
$file ->command( -label => 'Save');
$file ->command( -label => 'Save as..');
$file ->command( -label => 'Close', -command => \&exit);
$edit ->command( -label => 'Open');
$edit ->command( -label => 'Save');
$edit ->command( -label => 'Save as..');
$edit ->command( -label => 'Close', -command => \&exit);
MainLoop;
exit;
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.