Hi,

I have noticed a strange effect with images in NSCells (NSButtonCell, 
NSImageCell).

I have a NSTableView witch has a column filled with various images.
I have a button in the same window wich displays also one of these.
When image "A" is displayed in the button, all images "A" in the
table are correctly transparent, while the others are opaque with a 
white background. If I change the image in the button after program 
restart the effect is the same.
  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.
  I tested various combinations (both image displayed in two buttons, 
both have good trasparency in table cells), with xpms and tiffs.
Other single buttons display their image correctly.

Is the button cell "smarter" than the table view cell ?
Can this derive from the fact that NSTableView uses the same cell
for all cells ?

Maybe I'm missing somthing.
I use this code in the delegate of the table view:


/////////////
- (void)tableView:(NSTableView *)aTableView
   willDisplayCell:(id)aCell
    forTableColumn:(NSTableColumn *)aTableColumn
              row:(int)rowIndex
{

   id map,image = nil,value,name;

   if([[aTableColumn identifier] isEqual: @"type"]) {
         value = [dataSource tableView: aTableView
                        objectValueForTableColumn: aTableColumn
                        row: rowIndex];

     if(value) {
       map = [[[self class] iconMapping] objectForKey: [[dataSource 
entity] name]];

       if(map) {
        name =  [map objectForKey: [value description]];

        if(name)
          [aCell setImage: [NSImage imageNamed: name]];
       }
     }
   } else
     [aCell setType: NSTextCellType];


}
///////////////////////

Marko





_______________________________________________
Bug-gnustep mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to