• 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: FirstResponder in 10.4
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FirstResponder in 10.4


  • Subject: Re: FirstResponder in 10.4
  • From: Graham Cox <email@hidden>
  • Date: Tue, 23 Jun 2009 11:40:33 +1000


On 23/06/2009, at 3:06 AM, iseecolors wrote:

I have a NIB with a NSView that I use to populate a Contextual View in the Main Window. I have tried to set the firstResponder from IB, from init, from awakeFromNib, and from - (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor

All of these work in 10.5 (+), but only that last works in 10.4. Unfortunately the side effect of the last is that if the user clicks on a different edit field and starts to type, the focus is on the firstResponder instead of the field the user just clicked on.

I am sure I can continue to ________ with this, but it seems like there must be a better way. It seems unlikely that 10.4 is this messed up and it will not correctly set the firstResponder.

Any hints as to what I am missing?


It's very unclear what you're trying to do.

My interpretation is that you have a custom view, and you want to make it first responder? You don't "set" first responder in most cases. Instead, implement -acceptsFirstResponder and -canBecomeKeyView to return YES, and hook up the window's initialFirstResponder outlet to your view. If there are other candidates for first responder in your window, the user should be allowed to change it, so you may also want to include your view in the key loop (nextKeyView, previousKeyView), or set this to be recalculated automatically, and make it draw a focus ring when it is first responder.

To force a specific view to become first responder, you need to use the window's -makeFirstResponder: method, not by calling - becomeFirstResponder on the view itself - but doing this is usually unnecessary as you can set the initialFirstResponder in IB.

If this is irrelevant info, then you'll need to be clearer about what you're trying to achieve, and your current code.

--Graham


_______________________________________________

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: 
 >FirstResponder in 10.4 (From: iseecolors <email@hidden>)

  • Prev by Date: Re: number box class from NSTextField
  • Next by Date: Re: number box class from NSTextField
  • Previous by thread: FirstResponder in 10.4
  • Next by thread: How do I sync Quartz drawing-path coordinates with the physical iPhone UIView coordinates?
  • Index(es):
    • Date
    • Thread