Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I get a notification each time a EditText control contents changes?





On 6/12/06 1:37 AM, "Eric Schlegel" <email@hidden> wrote:

> 
> On Jun 11, 2006, at 7:40 PM, B.J. Buchalter wrote:
> 
>> I am trying to hook into an EditText Control (Unicode) -- actually,
>> in this
>> case a Search Field.
>> 
>> I would like to get a notification each time the text field changes
>> (either
>> due to typing/cut/paste/clicking on the little (x), etc.).
> 
> On Tiger and later, kEventTextDidChange should do it. Although it's
> possible that won't catch the little-x click. Please let us know one
> way or the other.

So, I can't use kEventTextDidChange cause I am targeting 10.3 too.

I have found that I need to do the following (and it appears to work OK):

For catching the text updates:

Add a { kEventClassTextInput,  kEventTextInputUnicodeForKeyEvent} on the
text control. In this handler, I call CallNextEventHandler(), and then
notify my clients afterwards.

For catching the little (x), it turns out that this just generates it's own
event {kEventClassSearchField, kEventSearchFieldCancelClicked}, and does not
change the text in any way. So I just add a handler for this event on the
control, and empty the field on the event and notify my clients.

Thanks for the help.

I'm not exactly sure what the best way to address this is, but it is way too
difficult to figure out what "things" each control supports and uses.
Perhaps it would be cool if there was one big table of all the controls with
a list of which events and parameters it responded to and generates, and
what events it makes sense to set handlers on the control for. Each control
has its own set of supported and required "stuff", and yet it seems like you
need to look in literally 10's of documents to figure it out, and it is
*not* all in the reference document. Just a thought.

Best regards,

B.J. Buchalter

Metric Halo
5 Donovan Drive
Hopewell Junction, NY 12533 USA
tel +1 845 223-6112
fax +1 603 250-2451


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: How do I get a notification each time a EditText control contents changes? (From: Eric Schlegel <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.