Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Problems with Tk::JComboBox

by rcseege (Pilgrim)
on Sep 20, 2006 at 09:10 UTC ( [id://573862]=note: print w/replies, xml ) Need Help??


in reply to Problems with Tk::JComboBox

Tk-JComboBox 1.12 has been uploaded to CPAN. I think it will resolve this issue. This release also includes minor updates to the docs and test cases. It also features a new examples directory that should grow larger over time. Here is a relevant example that demonstrates -popupcreate

use Tk; use Tk::JComboBox; my $mw = MainWindow->new; my $entry = $mw->Entry->pack; my $jcb = $mw->JComboBox( -choices => [qw/one two three four/], -entrywidth => '16', -highlightthickness => 0, -listwidth => '16', -mode => 'readonly', -popupcreate => \&addItems, )->pack; MainLoop; sub addItems { my @items = split(/ /, $entry->get()); $jcb->removeAllItems; $jcb->configure(-choices => \@items) if @items; }

For versions 1.11 and earlier the following serves as a partial workaround to the issue with -popupcreate. The last line can be included in callbacks to take care of Popup layout/positioning issues.

sub addItems { my @items = split(/ /, $entry->get()); $jcb->removeAllItems; $jcb->configure(-choices => \@items) if @items; $jcb->PopupCreate; }

Note that this will still have a problem if the JComboBox is empty, because the popupcreate callback will not get triggered. Version 1.12 accounts for this.

Rob

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-03-29 07:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found