• 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: Jens Alfke <email@hidden>
  • Date: Fri, 18 Apr 2008 18:12:19 -0700


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 (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

  • Follow-Ups:
    • Re: editing in a custom NSView
      • From: Torsten Curdt <email@hidden>
References: 
 >editing in a custom NSView (From: Torsten Curdt <email@hidden>)

  • Prev by Date: Re: Modal popup from command line tool or daemon?
  • Next by Date: Re: Hand style movement inside a NSScrollView
  • Previous by thread: controls in a NSTableCell (was Re: editing in a custom NSView)
  • Next by thread: Re: editing in a custom NSView
  • Index(es):
    • Date
    • Thread