I'm trying to get an image of an NSTableView row. Sounds simple but if you actually try it, you'll find that NSTableView is particularly resistant to this. Here is what I am looking for:

- The row must look like how it does to the user. In particular, the background must look like as it does when the window is key. In particular, retain the look of the row if it is a group row, in source list and regular mode. - The row will probably not be visible at the time (scrolled off). It may never have been visible before.

Methods used (all of which failed):

- -bitmapImageRepForCachingDisplayInRect:/- cacheDisplayInRect:toBitmapImageRep: created a blank image.
- -initWithFocusedViewRect:. I forget how it failed but it failed.
- Lock focus on image, drawRect (after proper coord system translations). Various but never entirely correct results. - Lock focus on image, -drawBackgroundInClipRect:/-drawRow:clipRect:. Background was never right. - Lock focus on image, cycle across the columns, do - preparedCellAtColumn:row: and draw each cell. Same as above. - -dragImageForRowsWithIndexes:tableColumns:event:offset: gets a row image but, as above, no background.

In the lock focus scenarios, I've even tried scrolling the row to visible, draw it, scroll back. In some cases, a slight improvement but never quite right. I suspect that NSTableView is optimized to the point where it won't draw anything properly that isn't visible, and it seems to do a way too good a job of it. Ideas?

paul

_______________________________________________

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