discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Transparency issues


From: Marko Mikulicic
Subject: Re: Transparency issues
Date: Tue, 21 Aug 2001 15:25:16 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.3) Gecko/20010801

Pierre-Yves Rivaille wrote:
On Mon, 20 Aug 2001, Marko Mikulicic wrote:


 Since NSTableView uses the same NSCell for all cells, that would
mean that the image is correctly displayed when at least two istances
of the same image are showed on screen.


That is not true. There is a cell for each column.

ah, yes. I forgotten. I had images in one column only
so I didn't notice my mistake.

 By default it is a
NSTextFieldCell, but if you only need to display an image, you can do the
following
  [myTableColumn setDataCell: [NSImageCell new]];
before inserting the column inside the tableView.

Using an NSImageCell might solve some of the issue you had with an
NSTextFieldCell, it is also more appropriate to use it when you only want
to display images and no text.

I tried NSImageCell as well, but it puts a margin around the image I can't disable. Also it leaves the white background.

I solved the problem with using setBackgroundColor: [NSColor controlBackgroun] on the image.



It is even possible to use specific cells for specific rows inside a
tableColumn.
To do this you should subclass NSTableColumn, and redefine
  [NSTableColumn dataCellForRow:]
so that it returns a specific cell for each row of the column.


I currently use the
- (void)tableView:(NSTableView *)aTableView
  willDisplayCell:(id)aCell
   forTableColumn:(NSTableColumn *)aTableColumn
          row:(int)rowIndex

interface because I can have up 10000 to rows, so I thought
it will change the image only for those items that are really shown.
If I set it using dataCellFor: i think I would waste space, no ?



(This can be useful to avoid useless redrawing, as whenever you change a
Cell in tableView:willDisplayCell:..., all part of the tableView that
shares this cell are marked as needing display. If that do not seem clear,
you can look at [NSTableView updateCell])

(for further information on [NSTableColumn dataCellForRow:] you can look
at
developer.apple.com/techpubs/macosx/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSTableColumn.html#//apple_ref/occ/instm/NSTableColumn/dataCellForRow

I readed that.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]