Subject: | grab function in JComboBox makes it unusable in dialog boxes |
I am using Tk::JComboBox 1.05 w/ Perl 5.8.6 on Fedora Core 2.
I'm not sure if this would be classified as a bug but it may be something to add to the documentation at least.
I have found that the grabRelease in &hidePopup and the grabGlobal in &showPopup make it inconvenient to use JComboBox in a custom dialog box.
Let me elaborate:
I created a custom dialog box using Tk::DialogBox. In the dialog I added a JComboBox widget. I then called grabGlobal on the dialog box so that the main window could not be effected until the DialogBox is closed.
The problem is, as soon as I open the menu in the JComboBox widget, the global grab on the DialogBox is lost. The main window becomes active and can be manipulated from that point on.
- Ken Prows
Attached is a simple script that demonstrates this problem.
#!/usr/bin/perl -w
use strict;
use Tk;
use Tk::DialogBox;
use Tk::JComboBox;
my $Main = MainWindow->new();
my $Btn = $Main->Button(-text=>"You can't click me until you open the JComboBox!")->pack;
my $Dialog = $Main->DialogBox(-title => 'JComboBox/DialogBox Grab Test');
$Dialog->add('Label', -text=>'This demonstrates how the JComboBox interferes with a DialogBox\'s grab.')->pack;
my $Jcb = $Dialog->add('JComboBox')->pack;
$Jcb->addItem('Open me to enable the main window button.', -selected=>1);
$Jcb->addItem('Main window should now be active..');
$Dialog->Show();
MainLoop();