Reliable script to handle selection/drag-and-drop in a list field?

Geoff Canyon gcanyon at gmail.com
Sun Jul 21 14:45:49 EDT 2013


Thanks Kaus for pointing it out, and particularly Scott who wrote the thing
in the first place. When I think back on all I went through with Navigator
trying to make the built-in drag-drop messages work (badly) it's
frustrating that this works so well without using the drag-drop messages at
all :-/

That said, this only does one line at a time, so I needed to dig in. I
spent some time yesterday and now:

1. The code is all in a behavior button. Set a list field's behavior to the
button, you're done.
2. The behavior sends an optional dragLines message to the field with what
lines were dragged where, making it easy to add functionality in the field
when the user does something.
3. It handles multiple lines, and discontiguous lines. Discontiguous lines
are shown being dragged together, i.e. the screen shot does not include the
lines between them that aren't being dragged. If there are more lines being
dragged than will fit in an image of the field, the extras are replaced
with an elipsis "..."
4. I removed the removal code. It would be simple to add it back.
5. There is about 40% less code, which (I think) will scale to extremely
large lists and selections better. I tried it with 10,000 lines and
selections of 1,000s and it worked fine on my machine.

I have not tested it extensively. It could be horribly broken in some way I
didn't notice. I put a huge disclaimer on it saying that it isn't the
original and put a copy here:
https://docs.google.com/file/d/0By_mW8YYOZpAWHpJQ1R4dlhZYTQ

Scott, feel free to grab it and do whatever with it, ignore it, or ask me
to take it down.

Anyone who uses it and finds bugs, please let me know here.

gc


On Thu, Jul 18, 2013 at 11:45 AM, Scott Rossi <scott at tactilemedia.com>wrote:

> You can load the stack directly in LC:
> go URL "http://www.tactilemedia.com/site_files/downloads/getinline.rev"
>
>
> But this manages single lines only -- you'd have make to make adjustments
> to handle multiple lines, which will be challenging with a discontiguous
> selection.
>
> Regards,
>
> Scott Rossi
> Creative Director
> Tactile Media, UX/UI Design
>
>
>
>
> On 7/18/13 9:39 AM, "Klaus major-k" <klaus at major-k.de> wrote:
>
> >Hi Geoff,
> >
> >Am 18.07.2013 um 18:23 schrieb Geoff Canyon <gcanyon at gmail.com>:
> >
> >> I did some quick research, and this looks to be as much of a pain as I
> >> remember -- or am I missing something? All I want is to place a
> >>scrolling
> >> list field on a card, enable the multipleLines and nonContiguousHilites
> >>of
> >> it, and then enable the (non-existent) supportDragAndDrop property.
> >
> >take a look at Scott Rossi's solution to this:
> ><http://www.tactilemedia.com/site_files/downloads/getinline.rev.zip>
> >
> >Not sure if this works with multilines, but should get you started :-)
> >
> >> On Wed, Jul 17, 2013 at 1:51 PM, Geoff Canyon <gcanyon at gmail.com>
> wrote:
> >>
> >>> Does anyone have code to share that allows discontiguous selection and
> >>> drag and drop within a list field? i.e. if I have a list field with:
> >>>
> >>> 1
> >>> 2
> >>> 3
> >>> 4
> >>> 5
> >>>
> >>> I can click 3 to select it, shift-click 5 to select 3 to 5,
> >>>command-click
> >>> 4 so that 3 and 5 are selected, and then click and drag 3 (with 5
> >>>along for
> >>> the ride) above 2 and end up with:
> >>>
> >>> 1
> >>> 3
> >>> 5
> >>> 2
> >>> 4
> >
> >Best
> >
> >Klaus
> >
> >--
> >Klaus Major
> >http://www.major-k.de
> >klaus at major-k.de
> >
> >
> >_______________________________________________
> >use-livecode mailing list
> >use-livecode at lists.runrev.com
> >Please visit this url to subscribe, unsubscribe and manage your
> >subscription preferences:
> >http://lists.runrev.com/mailman/listinfo/use-livecode
> >
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list