Re: NSTableView and drag and drop
Re: NSTableView and drag and drop
- Subject: Re: NSTableView and drag and drop
- From: chaitanya pandit <email@hidden>
- Date: Sat, 11 Oct 2008 20:26:33 +0530
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@hidden> wrote:
From: chaitanya pandit <email@hidden>
Subject: Re: NSTableView and drag and drop
To: email@hidden
Cc: email@hidden
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 (email@hidden)
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:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden