Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Value population based on selection

by mykl (Monk)
on Apr 29, 2009 at 13:21 UTC ( [id://760870]=note: print w/replies, xml ) Need Help??


in reply to Re: Value population based on selection
in thread Value population based on selection

What I think the Anonymonk is asking (and it is a good question) is what kind of object are you using to create the combobox? I know of Tk::BrowseEntry and Tk::JComboBox, for example. With either of these, the easiest way to get the user-selected value is to create a variable to hold the selected value, and ask the combobox to put the selected value there. With Tk::BrowseEntry this is done with the -variable option passed to to constructor:
my $value = ''; my $combo => $parent->BrowseEntry(-variable => \$value, ...);
Tk::JComboBox does the same thing but the option is called -textvariable. You can then just read $value when you detect that a selection has been made.

That's the 'How to get the user selected value' bit. To populate another list based on this value, well there's more than one way - you can reconfigure the -choices option:

$combo->config(-choices => ['foo', 'bar', baz'...]);

Or there are object methods that can remove items from the selection list and add others - see the docs for the combobox class you are using.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-16 08:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found