• 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: NSTextField does not lose focus
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField does not lose focus


  • Subject: Re: NSTextField does not lose focus
  • From: Torsten Curdt <email@hidden>
  • Date: Fri, 23 May 2008 18:57:16 +0200


On May 23, 2008, at 03:32, Ken Thomases wrote:

On May 22, 2008, at 5:53 AM, Torsten Curdt wrote:


On May 22, 2008, at 11:15, Torsten Curdt wrote:

I've got a NSTextField (on a NSTabView). I open the window. I click the text field and enter some text. Now I click on a button next to it.

The value has still not been "committed" and it still has the cursor.

Then I click outside of the text field (just somewhere in the view) and still the NSTextField does not lose it's focus.

What's going on? I looked through options in IB3. What do I need to read up on?

Got it ...I had to set the firstResponder to nil in the IBAction before I access the text field


[[self window] makeFirstResponder: nil];

If your intent was to have the text field set the value of a model key via bindings, that's not the recommended way of doing it. You should invoke the -commitEditing method of the controller. Do a full-text search for that method and the NSEditor informal protocol for more info.


This link <http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/WhatAreBindings.html#//apple_ref/doc/uid/20002372-177085 > actually refers to your exact scenario with a text field and a button.

Thanks, Ken!!

Indeed commitEditing sounds exactly like what I was after.

cheers
--
Torsten
_______________________________________________

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: 
 >NSTextField does not lose focus (From: Torsten Curdt <email@hidden>)
 >Re: NSTextField does not lose focus (From: Torsten Curdt <email@hidden>)
 >Re: NSTextField does not lose focus (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Gaussian blur with core image, using CPU or GPU?
  • Next by Date: Re: Appkido support for Iphone dev
  • Previous by thread: Re: NSTextField does not lose focus
  • Next by thread: Core Data: How to encrypt a persistent store
  • Index(es):
    • Date
    • Thread