How to reorder lines in a list field

FlexibleLearning admin at FlexibleLearning.com
Sat Oct 30 14:08:04 EDT 2010


A very nice handler, BvG!

As written it needs the traversalON to be true to display correctly. A minor
change to one line and it displays correctly whether the traversalON is
either true or false...

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
      set the hilitedLines of me to (word 2 of myselection)
      unlock screen
    end if
  end repeat
end mouseDown

Hugh Senior
FLCo




More information about the use-livecode mailing list