• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: editing in a custom NSView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: editing in a custom NSView


  • Subject: Re: editing in a custom NSView
  • From: Torsten Curdt <email@hidden>
  • Date: Sat, 19 Apr 2008 04:35:55 +0200


On Apr 19, 2008, at 03:12, Jens Alfke wrote:

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.

Now that I just found out that NSTableView *does* support different row heights the question comes up: is it easier to write such a custom view or subclass and tweak NSTableView.


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.

Ah, I see ...that was basically what I was thinking to implement for that view as well. But how would I swap in such a NSTextView in my custom NSView?


cheers
--
Torsten
_______________________________________________

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


References: 
 >editing in a custom NSView (From: Torsten Curdt <email@hidden>)
 >Re: editing in a custom NSView (From: Jens Alfke <email@hidden>)

  • Prev by Date: controls in a NSTableCell (was Re: editing in a custom NSView)
  • Next by Date: Re: Hand style movement inside a NSScrollView
  • Previous by thread: Re: editing in a custom NSView
  • Next by thread: Hand style movement inside a NSScrollView
  • Index(es):
    • Date
    • Thread