Drag List Items Up and Down

AndyP smudge.andy at googlemail.com
Thu Feb 2 11:14:04 EST 2017


Try this

Create a scrolling field

Add a few lines

In the field properties *check the Lock text* /it will not work without
this/


Add this to the field

on mouseDown
   put word 2 of the clickLine into tcl 
   set the textcolor of line tcl of me to "red"
   if line tcl of me is empty then
      exit mousedown
   end if 
   put item 2 of the mouseLoc into tstarty 
   put the effective textHeight of me into th 
   repeat while the mouse is down 
      if item 2 of the mouseLoc - tstarty > (th/2) then 
         lock screen 
         put cr & line tcl of me after line tcl + 1 of me 
         delete line tcl of me 
         add 1 to tcl 
         set the textcolor of line tcl of me to "red"
         add th to tstarty 
         unlock screen 
      else if tstarty - item 2 of the mouseLoc > (th/2) then 
         lock screen 
         put line tcl of me & cr before line tcl - 1 of me 
         delete line tcl + 1 of me 
         subtract 1 from tcl 
         set the textcolor of line tcl of me to "red" 
         subtract th from tstarty 
         unlock screen 
      end if 
   end repeat 
   set the textcolor of line tcl of me to "black"
   set the hilitedLine of me to tcl
end mouseDown

This came from a question on one of the forums, not sure which and from
whom.




-----
Andy Piddock 


My software never has bugs. It just develops random features. 

TinyIDE a Free alternative minimalist IDE Plugin for LiveCode
TinyIDE 


Script editor Themer for LC http://2108.co.uk  

PointandSee is a FREE simple but full featured under cursor colour picker / finder.
http://www.pointandsee.co.uk  - made with LiveCode
--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Drag-List-Items-Up-and-Down-tp4712158p4712163.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list