Dear monks,
I wonder if it is possible to 'cascade' the optionmenu widget or other widget different from the menu widget.
Why?
Consider below example. I want to avoid a too long list of options. The elements in the list always consists out of a static part+an index.
So it would be ideal if I could show the static part in the main optionlist and once this static part is selected, the dynamic part should appear.
So iso:
opt1 opt2 opt3 opt4 dinner1 dinner2 dinner3 dinner4 desert1 desert2 desert3 desert4 desert5
I want, visualized in Tk:
opt -> opt1 opt2 opt3 opt4
dinner -> dinner1 dinner2 dinner3 dinner4
desert -> desert1 desert2 desert3 desert4 desert5
#!/usr/local/bin/perl
use Tk;
# Main Window
$mw = new MainWindow;
my $var;
my $opt = $mw -> Optionmenu(-options => [qw(opt1 opt2 opt3 opt4 dinner
+1 dinner2 dinner3 dinner4 desert1 desert2 desert3 desert4 desert5 )],
-variable => \$var,
)->pack;
$mw->Button(-text=>'Exit', -command=>sub{$mw->destroy})->pack;
MainLoop;
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.