in reply to Perl/Tk BrowseEntry delete method [request for example]

Or, you could manipulate the listbox directly using Subwidget.

use strict; use warnings; use Tk; use Tk::BrowseEntry; my $var; my $mw = MainWindow->new; my $frame = $mw->Frame->pack; my $be = $frame->BrowseEntry( -label => "Label", -variable => \$var + ); $be->insert( 'end', "opt$_" ) for ( 0 .. 20 ); $be->pack( -pady => 5 ); my $lb = $be->Subwidget('slistbox'); my $bu = $frame->Button( -text => 'Delete Selected', -command => sub { $be->delete( $lb->curselection ) if $lb->curselection; $var = ''; }, )->pack( -pady => 5 ); MainLoop;

Replies are listed 'Best First'.
Re^2: Perl/Tk BrowseEntry delete method [request for example]
by TomKane (Beadle) on Nov 16, 2008 at 14:57 UTC
    Hey, thanks thundergnat. I didn't know about the Subwidget function of the tk::browseentry. It wasn't obvious to me from the documentation. I must have skimmed over a critical part and missed it. That lets me use the browse2cmd option and get the curselection() with the regular listbox function. I'm not a newbie anymore, but I've still got a lot to learn about the perl infernals. Tom