Re: nstextfield question
Re: nstextfield question
- Subject: Re: nstextfield question
- From: Charlie Dickman <email@hidden>
- Date: Fri, 27 Apr 2012 12:34:46 -0400
You should have a look at the documentation for NSFormatter. You can define a formatter for your text field that gets called when a number of different things happen to/in the text field.
You might also want to have a look at the delegate methods available for an NSTextField which get called when other things happen to/in the field.
At first you might think that building a formatter for a field that already does what you want is redundant but you may find that the advantage of being able to get control at virtually all stages of editing is worth it. I certainly do.
On Apr 27, 2012, at 12:12 PM, Rick C. wrote:
> Hi,
>
> I might be getting sleepy and overlooking the obvious, but I have a panel with a few text fields and I'm trying to figure out what gets called after entering a value into a text field and while it's still highlighted clicking it again? In my case when entering a value into one of my text fields (let's say "30") I append a string to that value (let's say "Days"). I do this in the action method. In my subclass in mouseDown I make it where if the value is "30 Days" when clicking the text field I will remove the "Days" so the user can easily edit only the "30" and I append the "Days" once again in the action method. My problem is after clicking Enter for that text field if the user would try to edit it again without that text field ever losing focus the "Days" is not removed because mouseDown doesn't get called. And I haven't been able to figure out what does get called in this situation? Thanks,
>
> rc
> _______________________________________________
>
> 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
Charlie Dickman
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