Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Perl/Tk BrowseEntry delete method [request for example]

by thundergnat (Deacon)
on Oct 15, 2008 at 17:54 UTC ( [id://717293]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://717293]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 21:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found