[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] keyUp detection



In the following code I can detect 'keyDown', 'mouseDown', and 'mouseUp'
but not 'keyUp'.
What's up with that?

Thanks,
David Seay

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

#!perl

use Mac::Events;
use Mac::Events qw(@Event $CurrentEvent);

$Event[keyDown] = \&keyDown_Handler;
$Event[keyUp] = \&keyUp_Handler;
$Event[mouseDown] = \&mouseDown_Handler;
$Event[mouseUp] = \&mouseUp_Handler;

WaitNextEvent while !$flag;

sub keyDown_Handler {
	my($ev) = @_;
	$k = chr($ev->character);
	if (($CurrentEvent->modifiers & 256) == 256 && $k eq ".") { $flag =
1 } # COMMAND "."
	else { print "KEY DOWN = $k\n\n" }
}

sub keyUp_Handler { print "KEY UP\n\n" }

sub mouseDown_Handler { print "MOUSE DOWN\n" }

sub mouseUp_Handler { print "MOUSE UP\n\n" }



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch