Hello!

I have spent much time to force my program working on my way and finally lost...
Below is the code. The question is: how to force the comboboxes (f2,f3) 
to catch TAB event similarly to that of the textfields(f0,f1)?

The mark of such behavior would be printing the "gogo" letters.

regards
Waldemar

PS I do not want use Win32::GUI::DialogBox; just want to catch keyboard events 
in comboboxes.

#########################################################
use Win32::GUI qw();
use warnings;
use strict;

my $where = 0;

my $mw  = new Win32::GUI::Window(
 -title => "Tab problem",
 -name  => "hmmm",
 -pos   => [ 100, 100 ],
 -size  => [ 310, 200 ],
);

my $f0      = $mw->AddTextfield(
 -name      => "f0",
 -text      => "1",
 -pos       => [  10, 10],
 -size      => [ 100, 20],
 -onKeyDown => \&::gogo,
);

my $f1 = $mw->AddTextfield(
 -name      => "f1",
 -text      => "2",
 -pos       => [ 120, 10],
 -size      => [ 100, 20],
 -onKeyDown => \&::gogo,
);

my $f2 = $mw->AddCombobox(
 -name         => "f2",
 -pos          => [  10,  50 ],
 -size         => [ 100, 100 ],
 -dropdown     => 1,
 -dropdownlist => 1,
 -onKeyDown    => \&::gogo,
);
$f2->InsertItem(0);
$f2->InsertItem(1);
$f2->InsertItem(2);
$f2->InsertItem(3);

$f2->SetCurSel(2);

my $f3 = $mw->AddCombobox(
 -name         => "f3",
 -pos          => [ 120,  50 ],
 -size         => [ 100, 100 ],
 -dropdown     => 1,
 -dropdownlist => 1,
 -onKeyDown    => \&::gogo,
);
$f3->InsertItem(4);
$f3->InsertItem(5);
$f3->InsertItem(6);

$f3->SetCurSel(0);

$f0->SetFocus();

sub gogo {
        print "gogo\n";

        $f0->SetFocus() if $where == 3;
        $f3->SetFocus() if $where == 2;
        $f2->SetFocus() if $where == 1;
        $f1->SetFocus() if $where == 0;

        $where++;
        $where = 0 if $where > 3;
}


$mw->Show();
Win32::GUI::Dialog();
__END__
#########################################################

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to