Here is a picture of what I need to do:

http://ericgorr.net/cocoadev/customcell/customcell.png

Basically, I need a NSOutlineView which can contain a set of selectable images with titles that can be edited. It also needs to support keyboard navigation and when a section is opened (like Gradients), every item that section contains needs to be visible. I might be blanking on some other minor behaviors, but these are the fundamental ones.

My first thought was that I could just use a NSCollectionView, but this is not possible at the moment (rdar://6455493 & rdar://4857136).

My second idea is that I could just dynamically add and remove columns & rows, but the problem is that in order to display the group titles, the column they are displayed in needs to be wide...when I added multiple columns, the column of the group title was never wide enough - they would always get clipped. If I had continued down this line, I suspect I would have had trouble dynamically adding and removing columns as the user was resizing the NSPanel.

The third idea was to subclass NSTextFieldCell and do all of the drawing myself. Each group (Gradients, Hatches, Images, etc.) contains just a single row with a single subclass of a NSTextFieldCell. It is this implementation that is pictured above. As you can see it mostly works and I can dynamically alter the row height so each item fits and moves to different rows as needed. The problem I am having with this is that I cannot seem to get any help with tracking the mouse (see the thread http://tinyurl.com/9y8to9).

The final idea is to dump NSTextFieldCell, since it seems to be eating all mouseUp and mouse tracking information, and go with a completely custom cell. I understand this may be a lot of work, but I cannot see a way around it at the moment.

I am hoping that someone else might have some alternate ideas or a pointer to some sample code of a subclass of NSCell which was written to work with a NSTableView.

One alternative that had been suggested is to simulate a NSOutlineView with a NSCollectionView. However, it is unclear how well this would actually work. Would it support the editing of the names of the items? Would it support rows of different heights?


_______________________________________________

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 arch...@mail-archive.com

Reply via email to