Re: Table View drops
Re: Table View drops
- Subject: Re: Table View drops
- From: mmalcolm crawford <email@hidden>
- Date: Fri, 17 Oct 2003 00:15:49 -0700
On Oct 16, 2003, at 10:59 PM, Scott Anguish wrote:
This is pulled from an NSTableView subclass that I have that only
accepts strings on the pasteboard.
Hmph, well, at one time it accepted NSURLs as well...
You can refine the restriction further by implementing
-tableView:validateDrop:proposedRow
Again, this is pulled from the same app.. the validateURLForASIN:
method looks at the URL, and then determines if it's in the format
that I expect. If it is, then I return NSDragOperationCopy, otherwise
NSDragOperationNone.
You'd check the file types of the dragged in files in place of this...
- (NSDragOperation)tableView:(NSTableView*)tableView
validateDrop:(id <NSDraggingInfo>)info
proposedRow:(int)row
proposedDropOperation:(NSTableViewDropOperation)operation
{
Oh, well if we're giving away source code, then perhaps we might also
mention:
- (BOOL)tableView:(NSTableView*)tableView
acceptDrop:(id <NSDraggingInfo>)info
row:(int)row
dropOperation:(NSTableViewDropOperation)operation
{
if (tableView != ourTableview) {
// don't drop onto self
return NSDragOperationNone;
}
NSPasteboard *pboard;
pboard = [info draggingPasteboard];
id *fetchObject = [get stuff from pasteboard];
if (fetchObject) {
return YES;
}
return NO;
}
:-)
** Note that these are methods implemented in the tableview's delegate.
**
mmalc
_______________________________________________
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.