Re: Fetch value from field editor during editing?
Re: Fetch value from field editor during editing?
- Subject: Re: Fetch value from field editor during editing?
- From: Russ <email@hidden>
- Date: Tue, 18 Nov 2008 09:03:29 -0800 (PST)
Yeah, I had one of these. Problem was, I needed two. I had the one set up using Target/Action instead of delegate. With the two separate flavors, much cheerier now. Thanks.
----- Original Message ----
From: Wayne Packard <email@hidden>
To: Russ <email@hidden>
Cc: email@hidden
Sent: Tuesday, November 18, 2008 1:48:09 AM
Subject: Re: Fetch value from field editor during editing?
There is a way. It works great. We (and by we, I mean the documentation) call it controlTextDidChange:.
Create a method like this:
- (void)controlTextDidChange:(NSNotification *)aNotification
{
NSTextField* field = [aNotification object];
NSLog([field stringValue]);
if ([[field stringValue] caseInsensitiveCompare:@"aircraft carrier"] == NSOrderedSame)
{
[field setStringValue:@"rowboat"];
}
}
Set the class containing this method as the delegate of the NSTextField. Run the app and type something in the field. Notice that each character will be logged as it is typed. Type aircraft carrier. Notice that the field now contains rowboat.
wp
On Nov 17, 2008, at 7:17 PM, Russ wrote:
> Nice try, but that definitely doesn't affect typing. According to the docs, it affects mouse tracking.
>
> NSTextField: why use the rowboat you need, when you can use an aircraft carrier instead.
>
> Still no way to find the text editor value while it is editing, or receive notifications as the value changes.
>
>
> ----- Original Message ----
> Sent: Monday, November 17, 2008 10:52:46 AM
> Subject: Re: Fetch value from field editor during editing?
>
> On Mon, Nov 17, 2008 at 10:41 AM, Russ wrote:
>>
>> Any ideas on why the field editor doesn't report the value as it is being edited?
>
> NSTextField is a subclass of NSControl. NSControl provides the
> -isContinuous / -setContinuous: methods. Try reading up on those ...
>
> --
> I.S.
>
>
>
>
> _______________________________________________
>
> 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
_______________________________________________
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