• 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: Making an NSTableView accept drag operations
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making an NSTableView accept drag operations


  • Subject: Re: Making an NSTableView accept drag operations
  • From: Wayne Pascoe <email@hidden>
  • Date: Wed, 10 May 2006 17:23:15 +0100


On 10 May 2006, at 17:06, Nick Zitzmann wrote:

Try creating an outlet that points to the table view.

Sorry, I think I confused myself :(

What I've done is define an
 IBOutlet NSTableView *tableView
in my DraggingFiles_AppDelegate.h file

I then dragged this to Interface Builder, and then control dragged from the AppDelegate to the NSTableView and connected the tableView outlet.

I also tried control dragging from my NSTableView to my DraggingFiles_AppDelegate, selecting the Outlets tab and connecting the delegate outlet.

I've also added the following to my DraggingFiles_AppDelegate.m:


- (void) awakeFromNib {
[tableView registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, nil]];
NSLog(@"Awoke from NIB");
}


- (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard*)pboard {
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:rowIndexes];
[pboard declareTypes:[NSArray arrayWithObject:NSFilenamesPboardType] owner:self];
[pboard setData:data forType:NSFilenamesPboardType];
return YES;

}


- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id )info proposedRow:(int)row proposedDropOperation:(NSTableViewDropOperation) op {

    NSLog(@"validate Drop");
	return NSDragOperationEvery;
}

- (BOOL)tableView:(NSTableView*)tv acceptDrop:(id )info row:(int)row dropOperation:(NSTableViewDropOperation)op {
NSLog(@"acceptDrop");
return YES;

}



I am still unable to drag a file to the tableview though. What am I missing ?


--
Wayne Pascoe    (gpg --keyserver www.co.uk.pgp.net --recv-keys 79A7C870)
Hanlon's Razor:
Never attribute to malice that which is adequately
explained by stupidity

Attachment: PGP.sig
Description: This is a digitally signed message part

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Making an NSTableView accept drag operations (From: Jerry Krinock <email@hidden>)
 >Re: Making an NSTableView accept drag operations (From: Wayne Pascoe <email@hidden>)
 >Re: Making an NSTableView accept drag operations (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: Making an NSTableView accept drag operations
  • Next by Date: Re: Progress window strategies?
  • Previous by thread: Re: Making an NSTableView accept drag operations
  • Next by thread: NSOutlineView expands column width
  • Index(es):
    • Date
    • Thread