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

In reply to Re: Problems with Tk::JComboBox by rcseege
in thread Problems with Tk::JComboBox by jdtoronto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.