• 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: Reordering a table insanity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reordering a table insanity


  • Subject: Re: Reordering a table insanity
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 28 Nov 2012 18:18:49 -0800

On Nov 28, 2012, at 17:24 , Graham Cox <email@hidden> wrote:

> Ideally I'd like the following method signature:
>
> - (void) moveStuffFrom:(NSIndexSet*) source to:(NSIndexSet*) destination;
>
> which internally calls [ [undoManager prepare...] moveStuffFrom:destination to:source]; to set up undo.
>
> this implies that the algorithm must by symmetric or universal, in that the two index sets supply all the necessary information, without any extra direction parameters (though that could be derived).

If I understand you correctly, then it can't be done without an extra parameter. The "coordinate system" of the indexes in *both* index sets is that of the original list. When you're undoing, all of the indexes in both index sets are "wrong" for the current state of the table. Even if the "right" indexes could be recovered, which I'm not sure about but perhaps, you still wouldn't know whether to do the recovery.

Descending to hand-waving, I suspect that the only way to do it with 2 parameters would be for each to be an array of indexes (not a set). Conceptually, each array would need to contain an entry for every row in the table, and each array would specify the rearrangement for one direction. (In practice, you could trim the beginning and end of each array to omit contiguous row indexes that aren't actually moving.)

That's as far as I've got with it.



_______________________________________________

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: Reordering a table insanity
      • From: Graham Cox <email@hidden>
References: 
 >Reordering a table insanity (From: Graham Cox <email@hidden>)
 >Re: Reordering a table insanity (From: Quincey Morris <email@hidden>)
 >Re: Reordering a table insanity (From: Graham Cox <email@hidden>)
 >Re: Reordering a table insanity (From: Graham Cox <email@hidden>)
 >Re: Reordering a table insanity (From: Quincey Morris <email@hidden>)
 >Re: Reordering a table insanity (From: Graham Cox <email@hidden>)
 >Re: Reordering a table insanity (From: Quincey Morris <email@hidden>)
 >Re: Reordering a table insanity (From: Quincey Morris <email@hidden>)
 >Re: Reordering a table insanity (From: Graham Cox <email@hidden>)
 >Re: Reordering a table insanity (From: Quincey Morris <email@hidden>)
 >Re: Reordering a table insanity (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Does anyone find Restore Snapshot kind of weak?
  • Next by Date: Re: Reordering a table insanity
  • Previous by thread: Re: Reordering a table insanity
  • Next by thread: Re: Reordering a table insanity
  • Index(es):
    • Date
    • Thread