my $desk_val = $desk->get('active');
Good luck,
{NULE}
--
http://www.nule.org | [reply] [d/l] |
thanks this does the job just fine :)
| [reply] |
Altho I'm no Tk guru, I can tell you that the hash returning is quite normal. $desk is an instance of Listbox (which is a class if you will). Most object properties are stored in a hash. You can't directly print the object, you probably want to print some of it's values. I didn't find a get method in the method list (altho gtget comes pretty close. I'm sure some of the more Tk minded monks can help you along, hope this helps a bit... Ignore this please
Greetz
Beatnik
... Quidquid perl dictum sit, altum viditur.
| [reply] [d/l] [select] |
If more than one item is selected, use:
@selected = $lb->curselection
to get a list of the index numbers for each selected item. Then use:
$select_item = $lb->get( $selected[#] )
If you know for a fact only one item is selected {NULE}'s method works. | [reply] [d/l] [select] |
Since this is a place where multiple values are possible (as ichimunki pointed out in (ichimunki) Re: perl/tk listbox), instead of testing for the number of items then deciding if you're dropping them into an array or scalar, why not just put the values into an array then loop through them in either case? Doing that, if only one item were returned, it would be the first element-would it not? Anyone (especially if I am in error in my considerations)?
| [reply] |