Re: NSTextField, NSTextFieldCell, NSTextView... this is a mess, I need help
Re: NSTextField, NSTextFieldCell, NSTextView... this is a mess, I need help
- Subject: Re: NSTextField, NSTextFieldCell, NSTextView... this is a mess, I need help
- From: Sailor Quasar <email@hidden>
- Date: Mon, 14 Jul 2003 17:52:52 -0400
On Friday, July 11, 2003, at 06:45 PM, Daryn wrote:
If you directly use a text view (ie. forget about a text field,
configure the view to look and act like a field), then there is no
need to worry about swapping in a custom field editor -- the text
view IS the field editor. Simply implement keyDown:.
Sounds an easy, elegant, perfect solution... until you look at the
two problems:
1) I can't define a custom NSTextView subclass in IB, nor can I size
it to the required height.
Sure you can. Create the class, then use a "custom view" and change
its class to your subclass. I think I've read notes on this list that
a text view needs to be in a scroll view to function properly, so keep
that in mind.
2) NSTextView is not a subclass of NSControl or NSActionCell, and
therefore does not have a -sendAction,
Use setFieldEditor:YES and implement textDidEndEditing: in your custom
text view's delegate. Check if the notification was caused by
NSReturnTextMovement. If so, send your action.
Well, I gave this an honest college try. The resultant interface did
work... but it was incredibly ugly. The text view had no focus ring and
I couldn't figure out how to give it one. I finally went back to my
hack that uses NSApplication subclass, because while it's not even
close to self-contained, it does work, it does look good and correct,
and it doesn't require very much code.
Maybe I'm just crazy. The compiler warnings for multicharacter
constants when I do comparisons like [string characterAtIndex:0] ==
'\0#' are driving me slowly insane. I know that's really not a good
tactic to use, but I can guarantee that the input to my NSStrings is
pure 7-bit ASCII so I can afford to assume that the UniChar output
always has a 0x00 high byte.
Why not cast the LHS to a char, or the RHS to a unichar?
I don't trust casting =).
-- Sailor Quasar, guardian of Leraz's memory
"A face of stone may hide a soul with the deepest Love of all"
Email: email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.