Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Option menu callbacks

by dimmesdale (Friar)
on Jul 23, 2002 at 13:17 UTC ( [id://184393]=perlquestion: print w/replies, xml ) Need Help??

dimmesdale has asked for the wisdom of the Perl Monks concerning the following question:

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?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://184393]
Approved by cfreak
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-20 04:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found