Hello!

This is my first message to this mailing list, so I would like to say "hi!" to everyone.

I am writing this e-mail, seeking for help from more experienced wxPerl users. A problem I am dealing with is that I cannot get any key pressed information while my program is running. It works fine for mouse events for example, I have no luck with keyboard events however.

Here is a simple example that best describes the issue I am dealing with:

--------------------------------------------------

#!/usr/bin/perl

my $myApp = MyApp->new();
$myApp->MainLoop;

package MyApp;

use base qw(Wx::App);
use Wx;
use Wx::Event qw(EVT_LEFT_DOWN EVT_KEY_DOWN);

sub OnInit {
    my $frame = Wx::Frame->new(undef, -1, 'TEST');
    $frame->Show();
    EVT_LEFT_DOWN($frame, \&mouse);
    EVT_KEY_DOWN($frame, \&keyboard);
    return 1;
}

sub mouse {
    print "Success! Left mouse button pressed!\n"
}

sub keyboard {
    print "Failure! Why cannot ever get here?\n"
}

1;

--------------------------------------------------

No matter what key I press on the keyboard, text from "keyboard" subroutine never appears in the console output. If you could somehow direct me how to get this to work, I would be very grateful.

Thanks for help!

Best regards,
Pawel Krol.

Reply via email to