• 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
Re: Correctly implementing page up/down, home and end for custom views?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Correctly implementing page up/down, home and end for custom views?


  • Subject: Re: Correctly implementing page up/down, home and end for custom views?
  • From: Andrew Merenbach <email@hidden>
  • Date: Mon, 30 Jul 2007 20:55:58 -0700

Oops, mistyped. You will need -keyDown: to call-interpretKeyEvents. This is the design pattern that was recommended to me.

- (void)keyDown:(NSEvent *)event {
    consumedKeyDown = NO;
    [self interpretKeyEvents:[NSArray arrayWithObject:event]];
    if (!consumedKeyDown) [super keyDown:event];
}

- (void)doCommandBySelector:(SEL)selector {
    consumedKeyDown = [self tryToPerform:selector with:nil];
}

-- where consumedKeyDown is an ivar.

Cheers, and sorry for the miscommunication,
	Andrew

On Jul 30, 2007, at 8:52 PM, Andrew Merenbach wrote:

Hi, Jim,

NSResponder has -scrollPageUp: and -scrollPageDown: as two of its overridable methods. I don't believe that you will need -keyDown:.

Cheers,
	Andrew

On Jul 30, 2007, at 8:39 PM, Jim Correia wrote:

I have a custom view which can be (and often is) embedded in an NSScrollView.

It appears that I get page up/down behavior for free. (By way of - [NSWindow _processKeyboardUIKey:].) But I don't get home/end behavior for free. (Is this a bug or oversight?)

What is the correct way to implement home/end?

I currently have overridden -keyDown: to call -interpretKeyEvents: and have (re)implemented the NSReponder methods for page up/down and home/end. This works, but is it the expected/correct design pattern?

Jim
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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


References: 
 >Correctly implementing page up/down, home and end for custom views? (From: Jim Correia <email@hidden>)
 >Re: Correctly implementing page up/down, home and end for custom views? (From: Andrew Merenbach <email@hidden>)

  • Prev by Date: Re: Correctly implementing page up/down, home and end for custom views?
  • Next by Date: Re: Values set in awakeFromInsert have gone missing.
  • Previous by thread: Re: Correctly implementing page up/down, home and end for custom views?
  • Next by thread: NSPropertyListSerialization from a subthread
  • Index(es):
    • Date
    • Thread