Re: NSTextField input validation
Re: NSTextField input validation
- Subject: Re: NSTextField input validation
- From: "Adam Venturella" <email@hidden>
- Date: Tue, 13 Jan 2009 09:32:27 -0800
It is my understanding that, NSTextFieldCell gets the windows field editor
when the user goes to edit the cell's contents. How I understood the docs
was that I need to override the cell's: setUpFieldEditorAttributes: as that
is the point at which the cell is getting the windows field editor. Once I
have that I can adjust it accordingly. Or I can override the NSWindows's
windowWillReturnFieldEditor:toObject: to customize it there.
Is there a location, in IB or otherwise that lets me configure the Field
Editor outside of the above methods?
On Tue, Jan 13, 2009 at 8:23 AM, Keary Suska <email@hidden>wrote:
>
> On Jan 12, 2009, at 5:22 PM, Adam Venturella wrote:
>
> So there we have it. Again this does do exactly what I want it to do, if
>> the user tries to enter a letter or anything not a number, I get an
>> NSBeep(); It works if the operation is a paste operation or initiated by a
>> keystroke.
>>
>> My main question, am I doing the right thing by casting the NSText into a
>> NSTextView, and is the NumberFormatter the best way to go in order to test
>> for a valid number or should I go the NSScanner route?
>>
>
> Subclassing NSTextFieldCell seems a bit unnecessary--why not just set the
> NSTextField delegate to one of your controllers? The whole
> -setUpFieldEditorAttributes seems a bit kludgey to me (and possibly prone to
> errors).
>
> Also, I would use an NSCharacterSet (-characterIsMember:) instead of
> NSFormatter or NSSCanner. Much more lightweight.
>
> HTH,
>
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
>
>
_______________________________________________
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