discuss-gnustep
[Top][All Lists]
Advanced

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

problem to get DnD working correctly with an NSTableView


From: Wolfgang Sourdeau
Subject: problem to get DnD working correctly with an NSTableView
Date: Wed, 13 Oct 2004 13:26:16 -0400
User-agent: Mutt/1.3.28i

Hi all,


As documented on developer.apple.com, when many drag types are
registered within a call to tableView:writeRows:toPasteboard:, you may
send zero or one data chunk to the pasteboard and the needed data will
be requested later by a call to pasteboard:provideDataForType: by the
NSPasteBoard to the "owner" (i.e. the tableview delegate).

Now, with GNUstep, pasteboard:provideDataForType: is never called while
it's possible to register all of the chunks within
tableView:writeRows:toPasteboard:. On OSX, only the first chunk
registered within that method is taken into account.

While I consider the OS X way to not be 100% right, it still works as
documented when on GNUstep it doesn't.

Example code, from Cynthiune:

- (BOOL) tableView: (NSTableView *) tv
         writeRows: (NSArray *) rows
      toPasteboard: (NSPasteboard*) pboard
{
  NSArray *types;
  BOOL accept;
  unsigned int count;

  count = [rows count];

  if (count > 0)
    {
      accept = YES;
      types = [NSArray arrayWithObjects: CynthiunePlaylistDragType,
                       NSFilenamesPboardType, nil];
      [pboard declareTypes: types owner: self];
      [pboard setPropertyList: rows forType: CynthiunePlaylistDragType];
    }
  else
    accept = NO;

  return accept;
}

- (void) pasteboard: (NSPasteboard *) sender
 provideDataForType: (NSString *) type
{
  NSLog (@"provide Data...");
}

I have then taken a look at gui 0.9.4's gui code for NSTableView and I
could not understand everything.
A work-around for this problem would be to call pasteboard:provideDataForType:
directly after writeRows... is called, but then it's not clean.

So, my question is:
- is there any current effort to fix this?
- if not and if I have time to fix it by myself, where should I look at?



Wolfgang
-- 
"An eye for an eye only makes the world blind." (Ghandi)




reply via email to

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