• 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: Rearranging NSOutlineView via drag-and-drop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rearranging NSOutlineView via drag-and-drop


  • Subject: Re: Rearranging NSOutlineView via drag-and-drop
  • From: Quincey Morris <email@hidden>
  • Date: Sat, 03 Jan 2015 20:33:02 +0000

On Jan 3, 2015, at 12:13 , Charles Jenkins <email@hidden> wrote:
>
> These things work, and I can verify that the object graph in the model has changed correctly. But to see the changes reflected in my Source View, I have to collapse and re-expand the affected nodes in order to have them reload data from the model in its new state. (I’m kind of surprised that updating the outline isn’t automatically done as a result of successfully accepting an NSDragOperationMove.)

The outline view doesn’t know the semantics of the move. All you’ve done, at the validation stage, is decide what kind of *feedback* to give to the user.

> Is it a good idea to call reload functions from outlineView:acceptDrop:item:childIndex:, or should I be doing something else to update the outline?

Something else. There are these methods that you use (in acceptDrop) to tell the outline view the semantics of what the drop did:

	moveItemAtIndex:…
	insertItemsAtIndexes:…
	removeItemsAtIndexes:…

By using combinations of these, you can avoid a reload. (Reloads essentially throw away information and re-acquire it. These methods describe the changes without loss of current state information.)

The effects of these methods are batched and deferred to a later iteration of the run loop, and they also have the benefit of allowing the outline view to animate the changes nicely, which a reload can’t do.



_______________________________________________

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


  • Follow-Ups:
    • Re: Rearranging NSOutlineView via drag-and-drop
      • From: Charles Jenkins <email@hidden>
References: 
 >Rearranging NSOutlineView via drag-and-drop (From: Charles Jenkins <email@hidden>)

  • Prev by Date: Rearranging NSOutlineView via drag-and-drop
  • Next by Date: GC / ARC question regarding screensavers under Mavericks
  • Previous by thread: Rearranging NSOutlineView via drag-and-drop
  • Next by thread: Re: Rearranging NSOutlineView via drag-and-drop
  • Index(es):
    • Date
    • Thread