Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Row dragging ...



On Jan 31, 2004, at 1:44 PM, J Nozzi wrote:

I've been searching and searching and unable to find a clear, concise answer to the following:
How in the world do you make an NSTableView able to respond to row drags? I want the user to be able to re-order rows (not columns) with a drag operation.
If anyone has a very simple explanation, I'd be most appreciative.

This is a "work in progress"(*), but it may be helpful:
<http://homepage.mac.com/mmalc/CocoaExamples/ TableViewDnDController.zip>

It illustrates use of an NSArrayController in conjunction with a "classic" document controller serving as the table view's delegate to allow drag and drop, and re-ordering, of multiple selections in a tableview.

In part it builds on the code sample Daryn posted yesterday to move objects in an array to a new index, but uses an NSIndexSet. It also shows how appropriate use of indexed accessor methods ensures that modifications to the content array are properly reflected in the tableview.

mmalc

(*) The main thing that isn't working properly in all cases is selection of rows after a move. I need to wake up a little to think about it...
_______________________________________________
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.
References: 
 >Row dragging ... (From: J Nozzi <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.