Hi Huub!

Thank you for your quick reply.

On 01/03/2011 12:38 AM, Huub Peters wrote:
> On Jan 2, 2011, at 7:45 PM, Pawel Krol wrote:
>
>> 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.
>
> What platform and versions are you using?
> Your snippet works fine on my Mac OsX (10.6.5):
>
> perl      : v5.8.9 built for darwin-2level
> wxPerl    : 0.93
> wxWidgets : wxWidgets 2.8.10

OS        : 2.6.32.26-175.fc12.x86_64 (tried both XFCE & KDE)
perl      : v5.10.0 built for x86_64-linux-thread-multi
wxPerl    : 0.92-1.fc12
wxWidgets : 2.8.11-1.fc12

Could that be that my version is too old to support this feature?

> Not the latest & greatest but unless there's a bug in the version you're using I don't see why it won't work.
> Did you try EVT_CHAR or EVT_KEY_UP too?

Yup, I did try them all. No luck there though.

> Also note that on most events you might want to call Skip() if you want it to propagate through to the native control(s):

Yup, already tried it out. It didn't help.

Any suggestions where to go from here?

Thanks!

Best regards,
Pawel Krol.

Reply via email to