• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTableView Drag And Drop gray background
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView Drag And Drop gray background


  • Subject: Re: NSTableView Drag And Drop gray background
  • From: Matthew Formica <email@hidden>
  • Date: Wed, 20 Jun 2001 11:38:33 -0700

You may be bumping into an NSTableView bug. Here's some code someone sent
me that you can try that works around it (or at least, works around a
similar bug):

@interface NSTableView (FixTableCoumnDataCells)
// This method helps work around a bug in NSTableColumn.
// The default dataCell that NSTableColumn will create for itself will
draw it's
// background (ie. drawsBackground==YES). However, it is un-necessary
(NSTableView
// already draws the background) and causes your drag image to look
incorrect.

- (void) fixColumnDataCell: (NSTableColumn *)tableColumn;
// Fix one particular column's dataCell.

- (void) fixAllColumnDataCells;
// Fix data cell of all the table view's columns.

@end


@implementation NSTableView (FixTableCoumnDataCells)

- (void) fixColumnDataCell: (NSTableColumn *)tableColumn {
// NOTE: This method assumes [tableColumn dataCell]==[tableColumn
dataCellForRow:N].
NSCell *dataCell = [tableColumn dataCell];
if ([dataCell respondsToSelector: @selector(setDrawsBackground:)]) {
[(id)dataCell setDrawsBackground: NO];
}
}

- (void) fixAllColumnDataCells {
int i=0, numberOfColumns = [self numberOfColumns];
NSArray *tableColumns = [self tableColumns];

for(i=0; i<numberOfColumns; i++) {
[self fixColumnDataCell: [tableColumns objectAtIndex:i]];
}
}

@end

Regards,

Matthew Formica
Apple DTS Engineer - Dev Tools and Cocoa
email@hidden


on 6/20/01 7:44 AM, Stiphane Sudre at email@hidden remarked:

> I'm doing some Drag And Drop stuff in a NSTableView and I'm getting a
> gray background for the third column of items in the Dragged Image.
>
> Since this problem is occuring with the default Cell prototype for
> NSTableView, I don't think I'm doing something wrong. Is it a bug or is
> there a flag to set ?
>
> I'm doing the same thing on a NSTableView where the thrid column
> contains a custom cell and I don't get this gray background at all...
> _______________________________________________
> cocoa-dev mailing list
> email@hidden
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev


References: 
 >NSTableView Drag And Drop gray background (From: Stéphane Sudre <email@hidden>)

  • Prev by Date: Re: Meaning of allocWithZone:NULL?
  • Next by Date: NSDocumentController patch
  • Previous by thread: NSTableView Drag And Drop gray background
  • Next by thread: Changing input methods in Cocoa
  • Index(es):
    • Date
    • Thread