I'm having trouble creating the correct procedure for some Tk::Optionmenus. There are two of them: one represents a list of subdirectories, the other represents a list of files. When a user changes the subdirectory optionmenu I want to change the file optionmenu to reflect said change.
I'm getting some problems, however, as I said. I'm creating several of these on a NoteBook interface, and it seems that on tabs after the first, the callbacks don't function correctly if I change the file optionmenu first.
Well... actually that was yesterday. Today the code isn't even working. I've done some debugging and it seems that the callback is getting an undefined (undef) value. So I tried the Ev( ... ) construct, but it's still undefined.
Here's the code that I have for the two optionmenu's:
my $fom = $page->[$_-1]->Optionmenu(
-variable => \$info->{file}->[$_-1],
-options => get_files($info->{subdir}->[$_-1]),
);
my $dom = $page->[$_-1]->Optionmenu(
-variable => \$info->{subdir}->[$_-1],
-options => [@subdirs],
-command => sub { $fom->configure(-options => get_fil
+es($_[0]->{base},$info->{subdir}->[$_-1])) },
);
What should I do to get the right value into the -command sub line?
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.