drag/drop to reorder text items in a list?
Wilhelm Sanke
sanke at hrz.uni-kassel.de
Thu Aug 14 16:51:00 EDT 2003
> Has anyone ever used Revolution to do dragging-and-dropping of lines of text
> within a text field? That is, permitting the user to drag line #15 within a
> text field between line 4 and 5 and having Revolution re-shuffle the list.
>
Try this:
on mouseDown
put word 2 of the clickLine into cl
set the textstyle of line cl of me to bold
put item 2 of the mouseLoc into starty
put the effective textHeight of me into th
repeat while the mouse is down
if item 2 of the mouseLoc - starty > (th/2) then
lock screen
put cr & line cl of me after line cl + 1 of me
delete line cl of me
add 1 to cl
set the textstyle of line cl of me to bold
add th to starty
unlock screen
else if starty - item 2 of the mouseLoc > (th/2) then
lock screen
put line cl of me & cr before line cl - 1 of me
delete line cl + 1 of me
subtract 1 from cl
set the textstyle of line cl of me to bold
subtract th from starty
unlock screen
end if
end repeat
set the textstyle of line cl of me to plain
end if
end mouseDown
Maybe there are simpler solutions.
Regards,
Wilhelm Sanke
More information about the use-livecode
mailing list