• 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: Table View drops
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Table View drops
      • From: Scott Anguish <email@hidden>
References: 
 >Table View drops (From: April Gendill <email@hidden>)
 >Re: Table View drops (From: Scott Anguish <email@hidden>)

  • Prev by Date: Re: Setting Network Preferences Programatically - Part 2
  • Next by Date: Re: Table View drops
  • Previous by thread: Re: Table View drops
  • Next by thread: Re: Table View drops
  • Index(es):
    • Date
    • Thread