On 18 Apr '08, at 4:32 PM, Torsten Curdt wrote:

So I already got a custom view that is manually bound to NSArrayController and draws the objects. Now I need to make one of the object's string attributes editable. How to do that best?

I assume I could catch the click on the item, then (somehow) show in place a NSTextView and have the user do the changes to the text. On every change I would check the height of the NSTextView and apply that to the drawing of the item. Once done I'll hide the NSTextView again. Does that sound like reasonable approach? Or how would you tackle this?

I'd implement your view as a container of NSTextField views. Listen for control-text-changed notifications from the subviews, and when you get one, check the view's field-editor* to see how high its content is, and update the view's size accordingly (which means moving other views up or down.)

*Controls with editable text don't do their own text editing. Instead they swap in a single NSTextView, called the field editor, that's usually shared between all controls in a window. So while the user's editing in a text field, you have to look at the field's currentEditor to get information about the text editing state.

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to