The thing is, I've done all that and no drags are initiated when I drag on the items. I have this in my tableview delegate:
But tableView:writeRowsWithIndexes:toPasteboard: is never even called. It seems to me that the examples have this code in the datasource or something rather than the delegate, but like I said, what do you do if you don't use a datasource. - (void)awakeFromNib { [tableView setDraggingSourceOperationMask:NSDragOperationEvery forLocal:YES]; [tableView setDraggingSourceOperationMask:NSDragOperationEvery forLocal:NO]; [tableView registerForDraggedTypes:[NSArray arrayWithObject:NSStringPboardType]]; } - (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pasteboard { [pasteboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:self]; [pasteboard setString:@"test string" forType:NSStringPboardType]; return YES; } --- On Sat, 10/11/08, chaitanya pandit <[EMAIL PROTECTED]> wrote: > From: chaitanya pandit <[EMAIL PROTECTED]> > Subject: Re: NSTableView and drag and drop > To: [EMAIL PROTECTED] > Cc: cocoa-dev@lists.apple.com > Date: Saturday, October 11, 2008, 7:56 AM > Well, for table view there is a similar method that you need > to > implement in your delegate: > - (BOOL)tableView:(NSTableView *)aTableView > writeRowsWithIndexes: > (NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard > *)pboard > > To allow dragging in a table view, you need to provide > information as > to what data you are dragging, dragging would be useless > unless you > provide any data for drag, You should write that data in to > the > dragging pasteboard when called at the above method and > return YES. In > your case you can simply write the string contents of the > represented > object in to the pasteboard for the NSStringPasteboardType > and return > YES > > Go through <NSTableDatasource> protocol. > HTH, > Chaitanya > > On 11-Oct-08, at 7:31 PM, Chris Idou wrote: > > > > > I'm confused by all the examples and > documentation. From what I > > read, the minimum required for a table to be a drag > source is to > > implement outlineView:writeItems:toPasteboard:. > However this method > > is something to do with datasources, and as I > understand it, when > > you use NSArrayControllers and so forth, you don't > use datasources. > > > > If I've got a regular NSTableView and > NSArrayController, where and > > when do I do what so that it can initiate drags? > > > > > > > > > > > > --- On Fri, 10/10/08, chaitanya pandit > <[EMAIL PROTECTED]> wrote: > > > >> From: chaitanya pandit > <[EMAIL PROTECTED]> > >> Subject: Re: NSTableView and drag and drop > >> To: [EMAIL PROTECTED] > >> Cc: cocoa-dev@lists.apple.com > >> Date: Friday, October 10, 2008, 11:50 PM > >> Have a look at > >> /Developer/Examples/Appkit/DragaNDropOutlineView > >> > >> On 11-Oct-08, at 9:06 AM, Chris Idou wrote: > >> > >>> I want to be able to drag strings out of a > table into > >> another field, > >>> but I must be missing something major because > drags > >> never get > >>> initiated. I've added the delegate, > registered > >> drag types and added > >>> delegate methods, but clicking and dragging > within the > >> table simply > >>> selects rows in the table, dragging is never > >> initiated. > >>> > >>> Is there some option I'm missing to turn > on drag > >> and drop? > >>> > >>> > >>> > >>> > >>> > >>> > >>> > _______________________________________________ > >>> > >>> Cocoa-dev mailing list > (Cocoa-dev@lists.apple.com) > >>> > >>> Please do not post admin requests or moderator > >> comments to the list. > >>> Contact the moderators at > >> cocoa-dev-admins(at)lists.apple.com > >>> > >>> Help/Unsubscribe/Update your Subscription: > >>> > >> > http://lists.apple.com/mailman/options/cocoa-dev/chaitanya%40expersis.com > >>> > >>> This email sent to [EMAIL PROTECTED] > > > > > > > > _______________________________________________ > > > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > > > Please do not post admin requests or moderator > comments to the list. > > Contact the moderators at > cocoa-dev-admins(at)lists.apple.com > > > > Help/Unsubscribe/Update your Subscription: > > > http://lists.apple.com/mailman/options/cocoa-dev/chaitanya%40expersis.com > > > > This email sent to [EMAIL PROTECTED] _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]