This part of your complaint caught my eye:
Even though the combobox on the first window is disabled, it still pops up the list.
The issues pointed out in JamesNC's reply are bound to be helpful. But apart from that, my own experience with JComboBox showed an odd behavior when using the attributes  -textvariable => \$scalar_var, -mode => 'editable', -validate => 'match' .

(update: fixed spelling and code tags above)

I came across this when I wanted users to be able to type and/or chose from a list to set a field in a database, and also show the an existing field value from the database when the user ran a query. Funny thing was, whenever I used a query result to set the value of the textvariable, the JCombobox list menu would pop up, and wouldn't go away until there was a mouse click. Very ugly. I had to work around it by invoking the widget's "hidepopup" method every time I set the textvariable's value. The following mindless script demonstrates the problem:

#!/usr/bin/perl use strict; use Tk; use Tk::JComboBox; my @choice = sort qw/Foo Bar Baz Red Green Blue Orange White Black/; my $chosen; my $mw = MainWindow->new(); $mw->Label(-text => 'Pick/type a value from JComboBox:')->pack(); my $cb = $mw->JComboBox(-width => 15, -textvariable => \$chosen, -choices => \@choice, -maxrows => 5, -mode => 'editable', -validate => 'match', -relief => 'sunken', )->pack(); $mw->Label(-text => 'or just push this button:')->pack(); $mw->Button(-text => 'Make a random choice', -command => sub { my $c = int(rand( scalar @choice )); print "$choice[$c] chosen at random\n"; $chosen = $choice[$c]; # uncomment the next line to fix errant JComboBox popup: # $cb->hidePopup(); } )->pack(); MainLoop;
It seems that the "validate => 'match'" thing is mostly responsible -- comment that out, and the popup isn't a problem. But then, you never get the popup when actually typing into the entry box either -- you don't get to see the next full choice based on what you've typed so far -- which defeats one of the big reasons for using this widget in the first place.

In reply to Re: Help with JComboBox by graff
in thread Help with JComboBox by ChrisR

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.