Re: more NSEvent stuff
Re: more NSEvent stuff
- Subject: Re: more NSEvent stuff
- From: Henry McGilton <email@hidden>
- Date: Sun, 4 May 2003 23:04:14 -0700
This is a little bit of a keyDown method from a couple of
my simple little apps (Rulers and Protractors). Adjust to
your taste, as 'they' say . . .
- (void)keyDown:(NSEvent *)theEvent
{
NSString *characters = [theEvent characters];
int key = [characters characterAtIndex: 0];
BOOL movingfromarrows = NO;
float xoffset;
float yoffset;
if (key == NSUpArrowFunctionKey) {
xoffset = 0.0; yoffset = 1.0; movingfromarrows = YES;
} else if (key == NSDownArrowFunctionKey) {
xoffset = 0.0; yoffset = -1.0; movingfromarrows = YES;
} else if (key == NSLeftArrowFunctionKey) {
xoffset = -1.0; yoffset = 0.0; movingfromarrows = YES;
} else if (key == NSRightArrowFunctionKey) {
xoffset = 1.0; yoffset = 0.0; movingfromarrows = YES;
}
. . . whacka whacka whacka . . .
}
Look in the documentation for NSEvent . . .
Best Wishes,
........ Henry
===============================+============================
Henry McGilton | Trilithon Software
Boulevardier, Java Composer | Seroia Research
-------------------------------+----------------------------
mailto:email@hidden |
http://www.trilithon.com
|
===============================+============================
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.