Re: NSSearchField Usage
Re: NSSearchField Usage
- Subject: Re: NSSearchField Usage
- From: Matt Neuburg <email@hidden>
- Date: Sun, 08 May 2005 15:57:18 -0700
On Sat, 7 May 2005 17:44:10 -0400, Graham <email@hidden> said:
>Hi,
>
>I am using the NSSearchField class for the firs time.
>I want to know how to differentiate the two actions:
>- User presses enter in the search field
>- User clicks the cancel icon in the search field
>since both call controlTextDidEndEditing() and in both cases if I
>query the text in the search field it is the same.
I'm not clear on what controlTextDidEndEditing() is supposed to have to do
with it. When the user presses enter or clicks the cancel icon, that is the
NSSearchField's action. Cocoa uses an action->target architecture for this
situation. In the target, your job is to receive the action. The action has
a sender (the NSSearchField) which has a value (what's in the
NSSearchField). Your action method is told who the sender is, so you can
retrieve the sender's value. If that value is nil or the empty string do one
thing (the user has cancelled a search). Otherwise do a different thing (the
user is asking for a search to be performed). m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
_______________________________________________
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