• 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: Force an NSTextField to give up focus
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Force an NSTextField to give up focus


  • Subject: Re: Force an NSTextField to give up focus
  • From: Dan Saul <email@hidden>
  • Date: Mon, 14 Mar 2005 01:17:50 -0600

Try calling -resignFirstResponder on the textfield.


On Sun, 13 Mar 2005 16:57:04 -0500, Gwynne <email@hidden> wrote:
> I have a window with two NSTextFields and an NSButton. There are no
> bindings involved, and neither of the fields has a target or action.
> When the button is activated, I need one of the fields to receive the
> user focus. I tried [window makeFirstResponder:firstField], but it only
> worked if the focus was either already on that field or on the button.
> If the focus was on the second field, there was no effect. I tried all
> sorts of calls, including -endEditingFor:, -selectNextKeyView:, and all
> combinations of setting the first responder to the window, nil, and the
> first field, but nothing worked. Finally, in order to get the second
> field to give up focus, I had to disable it, call makeFirstResponder
> for the first field, and re-enable the second field during the next
> iteration of the run loop.
>
> What am I doing wrong here? The second field has an NSFormatter
> attached, but the problem continued even when I tried removing the
> formatter. The Tab key works perfectly. These calls were being made
> from the action method of the button.
>
> -- Gwynne, key to the Code
> Email: email@hidden
> Website: http://musicimage.plasticchicken.com/
> "This whole world is an asylum for the incurable."
>
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
>
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Force an NSTextField to give up focus (From: Gwynne <email@hidden>)

  • Prev by Date: Re: NSWorkspace's notificationCenter
  • Next by Date: Re: Cocoa-dev Digest, Vol 2, Issue 346
  • Previous by thread: Re: Force an NSTextField to give up focus
  • Next by thread: Composite NSCell subclass event handling
  • Index(es):
    • Date
    • Thread