Re: cocoa-dev digest, Vol 2 #4247 - 14 msgs
Re: cocoa-dev digest, Vol 2 #4247 - 14 msgs
- Subject: Re: cocoa-dev digest, Vol 2 #4247 - 14 msgs
- From: Tim Hewett <email@hidden>
- Date: Wed, 26 May 2004 09:14:02 +0100
Greg,
It looks like you are not declaring the types in the pasteboard. I also
declare custom pasteboard types and I make sure the pasteboard
received in tableView:writeRows:toPasteboard is redefined from the
ground up using (e.g. for your case):
[pboard declareTypes:[NSArray arrayWithObjects: FTPLocalFilePBoardType,
nil] owner:self];
Your calls to setPropertyList:forType: on the pasteboard are probably
doing nothing as it looks like those types don't exist in the pasteboard
yet. It would certainly explain why your tables are not reacting to the
drag/drop in spite of registering for these types.
Tim Hewett.
http://www.coolatoola.com
On 26 May 2004, at 02:51, email@hidden wrote:
Hi,
I have two table views that I am trying to get drag and drop working in
them. It is for an ftp client and the local file table listens for the
remote type and the remote table listens for the local type. I register
the drag type is the awake from nib as below.
[localTable registerForDraggedTypes:[NSArray
arrayWithObject:FTPRemoteFilePBoardType]];
[remoteTable registerForDraggedTypes:[NSArray
arrayWithObject:FTPLocalFilePBoardType]];
In the data source methods for the table's dragging (which does get
called) I write the file selections to the plist like below
- (BOOL)tableView:(NSTableView *)tableView writeRows:(NSArray *)rows
toPasteboard:(NSPasteboard *)pboard
{
NSLog(@"Writing Rows");
if (tableView == localTable)
{
NSMutableArray *files = [NSMutableArray array];
NSEnumerator *e = [rows objectEnumerator];
NSNumber *cur;
while (cur = [e nextObject])
{
NSString *file = [localFiles objectAtIndex:[cur intValue]];
[files addObject:file];
}
[pboard setPropertyList:files forType:FTPLocalFilePBoardType]; //
return YES;
}
else if (tableView == remoteTable)
{
NSMutableArray *f = [NSMutableArray array];
NSEnumerator *e = [rows objectEnumerator];
NSNumber *cur;
while (cur = [e nextObject])
{
NSDictionary *file = [remoteFiles objectAtIndex:[cur intValue]];
if ([[file objectForKey:FTPDirectoryTypeKey] intValue] ==
FTPDirectoryTypeDirectory)
[f addObject:[file objectForKey:FTPDirectoryFilenameKey]];
}
[pboard setPropertyList:f forType:FTPRemoteFilePBoardType]; //
return YES;
}
return NO;
}
From here on in, none of the other datasource drag methods are getting
called and I cannot figure out why. Does anyone have a logical
explanation as to why a drag method would not get called?
Any help is greatly appreciated.
Regards,
Greg
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.