controls in a NSTableCell (was Re: editing in a custom NSView)
controls in a NSTableCell (was Re: editing in a custom NSView)
- Subject: controls in a NSTableCell (was Re: editing in a custom NSView)
- From: Torsten Curdt <email@hidden>
- Date: Sat, 19 Apr 2008 04:25:08 +0200
Bizarre ...remember I read it somewhere. Well, fair enough. Now got my
NSTableView with different row heights working. But how do I get other
edit controls in there? Is this the only way to stick a NSView in
there? http://www.stepwise.com/Articles/Technical/2003-12-20.01.html
Essentially I would want to edit a string, a checkbox/boolean, a date
and use a proper layout ...not just have them in columns
cheers
--
Torsten
On Apr 19, 2008, at 02:01, Mike Manzano wrote:
NSTableView:
tableView:heightOfRow:
Returns the height of row in tableView.
- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:
(NSInteger)row
Discussion
You should implement this method if your table supports varying row
heights. The height returned should not include intercell spacing
and must be greater than zero.
Although table views may cache the returned values, you should
ensure that this method is efficient. When you change a row's height
you must invalidate the existing row height by calling
noteHeightOfRowsWithIndexesChanged:. NSTableView automatically
invalidates its entire row height cache when reloadData and
noteNumberOfRowsChanged are called.
Availability
• Available in Mac OS X v10.4 and later.
Declared InNSTableView.h
On Apr 18, 2008, at 4:32 PM, Torsten Curdt wrote:
Hey guys,
I need some pointers into the right direction.
I would like to create a view that display a list of objects with
their attributes. Of course NSTableView could do that. But I would
like the rows to expand vertically when I add more information to
the object ...and have the attributes not just layed out in column
based manner. The most simple example: a list of multi line edit
fields. Example: OmniOutliner - press alt-enter and the line height
increases. AFAIK you cannot do that with either NSTableView or
NSCollectionView as the row heights may be different per row.
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?
Any suggested example or open source project to look at?
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