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.
|