• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Simulate UpArrowKey with 8-key
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: How to add messages to Cocoa's Run Loop
  • Next by Date: Re: Bindings + contents of an array. No dice, for newb.
  • Previous by thread: Re: How to add messages to Cocoa's Run Loop
  • Next by thread: characterAtIndex: method and composite characters
  • Index(es):
    • Date
    • Thread