Simulate UpArrowKey with 8-key
Simulate UpArrowKey with 8-key
- Subject: Simulate UpArrowKey with 8-key
- From: Johan Augustsson <email@hidden>
- Date: Wed, 4 Apr 2007 14:54:25 +0200
Hi
What is wrong with the following implementation of my NSBrowser
subclass?
- (void)keyDown:(NSEvent *)theEvent {
int selectedColumn = [self selectedColumn]-1;
int selectedRow = [self selectedRowInColumn:selectedColumn];
NSLog(@"Key %d", [theEvent keyCode]);
NSLog(@"Row %d, Col %d", selectedRow, selectedColumn);
if([theEvent keyCode]==91 && (selectedRow>0)) //8
[self selectRow:selectedRow-1 inColumn:selectedColumn];
}
My intention is to simulate an uparrowkey press when the user press
8. The first press of 8 makes the browser change line, but
NSBrowser's delegate methods are not called. The second and further
presses of 8 makes nothing and the browser's selected row and column
is -1.
What is wrong in this code? Does it exists a better solution? Can I
in my keyDown function simulate an upArrowKey? I tried with
performKeyEquivalent, but that did nothing. Perhaps I created the
event wrong.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden