discuss-gnustep
[Top][All Lists]
Advanced

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

Re: problem to get DnD working correctly with an NSTableView


From: Fred Kiefer
Subject: Re: problem to get DnD working correctly with an NSTableView
Date: Thu, 04 Nov 2004 21:09:00 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040114

Wolfgang Sourdeau wrote:
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?


Looks like you never did get a reply on this mail. And I must admit that I also have problems to understand what the issue for you is. From what I can see in your example code, I would expectt that when the pasteboard gets asked for the data for the type CynthiunePlaylistDragType, than it will use the already stored value and if asked for the data for type NSFilenamesPboardType, it will call the provided pasteboard:provideDataForType: method. None of this si specific to the NSTableView in any way and should be working that way for GNUstep. If it doesn't this is a bug in gpbs.m in the backend. I would be very much surprise to learn about such a bug being unnotice up to now, still this is possible. But if you are expectign any other behaviour, you should be explaining which one and why?

Fred




reply via email to

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