PDA

View Full Version : addresbook-like edit cells inside NSTextView




MrFusion
Jan 1, 2007, 04:03 PM
Hey,

When you edit a contact in addresbook, you get a number of fields on which you can click. When you do this a textfield pops up that is editable.
I am trying to get something similar.

I already know that I need to use NSAttributedStrings in a NSTextView together with NSTextAttachment. And I need to implement the NSTextAttachmentCell protocol. Almost no NS...Cell implements this (completely).

First step I did was to try to display some inline buttons with NSTextAttachment. This works, although it isn't nicely positioned with regard to the rest of the text.

Next was trying to edit the text of the cell. So I subclassed NSTextFieldCell. It displays the text, but is not editable. Although I did try to set the "editable" flag.

Any ideas how I should procede?