On Jan 3, 2011, at 8:55 AM, Octavian Rasnita wrote:
> Hi and I wish you a happy new year,
Likewise..
>
> Regarding the detection of hotkeys in a WxPerl application, please tell me
> which keys can be detected.
>
> I have seen that I can't detect when the Alt key is pressed.
>
> I am interested which of the following keys can be detected when they are
> pressed together with a letter or number or F1-F12 key:
> - Control
> - Alt
> - Shift
> - Insert
> - WindowsKey
>
> Thank you.
> --Octavian
It seems that problems with Key detection are common nowadays so maybe there's
a buggy version out somewhere. (Eg: mail from Pawel Krol on the mailing list)
For me key detection works properly. I've taken the example from Pawel's mail
and tweaked it a bit and this is all working for me.
Os : Mac OsX (10.6.5)
perl : v5.8.9 built for darwin-2level
wxPerl : 0.93
wxWidgets : wxWidgets 2.8.10
Cheers,
Huub.
-------------------------------------------------------------
#!/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_KEY_DOWN($frame, \&keyboard);
return 1;
}
sub keyboard {
my( $self, $event ) = @_;
printf "Code: %d\t|\tShift: %d\t|\tAlt: %d\t|\tCtrl: %d\t|\tMeta:
%d\t|\tCmd: %d\n",
$event->GetKeyCode, $event->ShiftDown, $event->AltDown,
$event->ControlDown, $event->MetaDown, $event->CmdDown;
$event->Skip();
}
1;