Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tk, quickie

Status
Not open for further replies.

zackiv31

Programmer
Joined
May 25, 2006
Messages
148
Location
US
Any time the selection changes in the listbox, the virtual event <<ListboxSelect>> will be generated. It is easiest to bind to this event to be made aware of any changes to listbox selection.

assuming $LB is my listBox, how can I use the above to do something whenever something in the list is selected?

(I just don't know the syntax)
 
Try:

Code:
$LB->bind ('<<ListboxSelect>>', sub {
   print "The selection has changed!\n";
   my $index = $LB->curselection;
   my $value = $LB->get ($index);
   print "The new value is: $value\n";
});

If the listbox allows multiple selections, curselection returns an array of indices, and you'dd need to get each one.
 
That doesn't work... doesn't seem to be catching the Event..

Any other ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top