How to reorder lines in a list field

Björnke von Gierke bvg at mac.com
Sat Oct 30 09:42:24 EDT 2010


I can't help you with code from someone else that I have no intention of looking at. Most likely a mouseenter or mouseleave doesn't trigger, no clue. For reordering lines, there's no build in way, and there are many possible ways to do it. Here's mine. It uses just the list field, and is probably a bit simplistic (no floating line/drag image following the mouse cursor). But it works for a single selection list field.

on mousedown
  put the selectedText of me into myDrag
  put the mouseLine into mySelection
  repeat while the mouse is down
    put the mouseLine into toSelect
    if mySelection <> toSelect and toSelect <> "" then
      put the scroll of me into theScroll
      put me into theText
      put word 2 of toSelect into LinetoSelect
      if lineToSelect = the number of lines of me then
        delete line (word 2 of mySelection) of theText
        put return & myDrag after line -1 of theText
      else
        delete line (word 2 of mySelection) of theText
        put myDrag & return before line lineToSelect of theText
      end if
      put toSelect into mySelection
      lock screen
      put theText into me
      set the scroll of me to theScroll
      select line (word 2 of myselection) of me
      unlock screen
    end if
  end repeat
  showSettings
end mouseDown


On 30 Oct 2010, at 15:18, André Bisseret wrote:

> Bonjour,
> 
> I am trying to get a list field where it would be possible to reorder the lines.
> (is there somewhere any tutorial or any solution on this?)



-- 

official ChatRev page:
http://bjoernke.com?target=chatrev

Chat with other RunRev developers:
go stack URL "http://bjoernke.com/chatrev/chatrev1.3b3.rev"




More information about the use-livecode mailing list