Re: Text Field Limits and Undo
Re: Text Field Limits and Undo
- Subject: Re: Text Field Limits and Undo
- From: Mike Rossetti <email@hidden>
- Date: Thu, 11 Aug 2005 15:19:54 -0600
This is actually what I did (created a custom NSFormatter) and
appreciate the recommendations to do so.
It wasn't actually too hard to do--mostly just a learning experience.
I started with the BusyPalette example
(/Developer/Examples/InterfaceBuilder/) as a base. I gradually added
bits of the new NSFormatter (LengthLimitFormatter), continually testing
(since testing with IB is not so simple) until it was working well and
then gradually stripped portions of the example out until all that was
left was my special formatter.
The end result was a nice palette for IB with the LengthLimitFormatter
(ready to be dragged onto the hundred or so text fields) and a
framework which I linked into my application (and dropped into
/Library/Frameworks/ so that IB could find it).
For debugging there were two key things I learned:
1) You can attach to IB with gdb and set breakpoints in the palette
code.
2) The console has informative messages should IB fail to load your
palette.
In addition to BusyPalette, the MOKit palette example might be helpful.
http://www.lorax.com/FreeStuff/MOKit.html
Mike
On Aug 11, 2005, at 1:07 AM, jkp wrote:
I think this would be the 'official' way to do it. The formatter wont
be complex, and i believe if you really want it available from IB you
could palletise it, though to save the hassle of two lines of code
(to instantiate and attach it) im not sure its worth it.
On 10 Aug 2005, at 16:46, Mike Rossetti wrote:
- Use a custom NSFormatter. I can't seem to find a way to get IB to
allow me to add a custom formatter to an NSTextField. Even if I
could, I'm not sure I could set the limit within IB. Is there a way
to extend IB to support this kind of thing? This would really be the
best approach.
_______________________________________________
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