in reply to How can I get the index of the currently selected Tk::BrowseEntry element?

Here you go. You need to use -browse2cmd to get the index number of the selected item.
use Tk; use Tk::BrowseEntry; my @items; my $BrowseEntryindex; my $cur_index; my $mw = MainWindow->new(); $items[0]{'cmd'} = sub{print "First BrowseEntry Index Selected\n"}; $items[1]->{'cmd'} = sub{print "Second BrowseEntry Index Selected\n"}; my $dropdown = $mw->BrowseEntry( -label => 'Items',-browse2cmd => sub{ +&{$items[$_->{'_BE_curIndex'}]{'cmd'}};} )->pack; $dropdown->insert('end', 'First'); $dropdown->insert('end', 'Second'); $mw->MainLoop;
  • Comment on Re: How can I get the index of the currently selected Tk::BrowseEntry element?
  • Download Code