• 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: NSSearchField - detect loss of focus
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSearchField - detect loss of focus


  • Subject: Re: NSSearchField - detect loss of focus
  • From: Corbin Dunn <email@hidden>
  • Date: Fri, 6 Jan 2006 08:37:37 -0800

Keith,

I have an NSSearchField in my toolbar and the results of the search are displayed in an NSTableView - very similar to the way it works in OSX 10.4 in the search field in the Apple System Preferences panel.

After searching the user can
(a) select an item from the NSTableView or
(b) click anywhere else on the screen to indicate that they are no longer interested in the search results.

That sounds like some very strange UI -- having a click loose the search results. But, I'll assume you have a good reason for it :)



For case (b) how do I detect when the NSSearchField loses keyboard focus - so that I can then hide the NSTableView?

Take a look at resignFirstResponder. You'll have to subclass NSSearchField, and you can send your delegate a message in this method.


-corbin

resignFirstResponder
- (BOOL)resignFirstResponder

Notifies the receiver that it’s been asked to relinquish its status as first responder in its NSWindow. NSResponder’s implementation returns YES, resigning first responder status. Subclasses can override this method to update state or perform some action such as unhighlighting the selection, or to return NO, refusing to relinquish first responder status.
Use NSWindow’s makeFirstResponder:, not this method, to make an object the first responder. Never invoke this method directly.
See Also: – becomeFirstResponder, – acceptsFirstResponder _______________________________________________
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: 
 >NSSearchField - detect loss of focus (From: Keith Wilson <email@hidden>)

  • Prev by Date: Re: Not getting filetype info from FSGetcatlogInfo() function
  • Next by Date: Re: Drag and Drop between two Tableviews
  • Previous by thread: NSSearchField - detect loss of focus
  • Next by thread: Re: NSSearchField - detect loss of focus
  • Index(es):
    • Date
    • Thread