Dragging Lines in a Field
shop
shop at paynesparkman.com
Thu Apr 18 10:17:01 EDT 2002
This code is located in the field you want to rearrange. If you click on a
line in the field while holding down the shift key, the text in that line is
removed from the field and placed in the label of a btn (btn id 2713) which
is normally hidden. That btn is made visible and it follows the mouse as
long as the shift key is down. This script was carried over from an old
Hypercard stack and I haven't had time to see if I can accomplish this more
efficiently with some new MetaCard fns or handlers. Since it works quite
well, I haven't really seen the need. You night need to play around with
the fld properties to get it just the way you want it.
on MouseDown
select the ClickLine
# if the optionKey is down then
# delete the ClickLine
# end if
pass MouseDown
end MouseDown
on MouseStillDown
if the ShiftKey is down and the OptionKey is up then
put the ClickLine into CkLn
put value(the ClickLine) into moveTxt
if moveTxt is empty then exit MouseStillDown
delete line (word 2 of CkLn) of me
set the name of btn id 2713 to MoveTxt
put item 2 of the topLeft of me into VPos
put item 1 of the topLeft of me into HPos
put the textHeight of me into linHt
set the width of cd btn id 2713 to (the width of me) - 17
set the height of cd btn id 2713 to LinHt
set the topLeft of cd btn id 2713 to HPos,VPos
repeat until the mouse is up
put the MouseV into CurMouse
if CurMouse < VPos then
put VPos into CurMouse
put the scroll of me into temp
subtract LinHt from temp
set the scroll of me to temp
end if
if CurMouse > (VPos + the height of me) then
put the scroll of me into temp
add LinHt to temp
set the scroll of me to temp
end if
put ((CurMouse - VPos) div linHt) into CurLinPtr
# set the topLeft of cd btn id 2713 to HPos,VPos+(13*CurLinPtr)
set the topLeft of cd btn id 2713 to HPos,the mouseV-LinHt/2
set the visible of cd btn id 2713 to true
end repeat
if the scroll of me 0 then
end if
set the visible of cd btn id 2713 to false
put ((CurMouse - VPos) div linHt)+1 into CurLinPtr
if the scroll of me 0 then
add (the scroll of me / LinHt) div 1 to CurLinPtr
end if
put the number of lines in me into ListLen
if CurLinPtr > ListLen then
put return&moveTxt after the last line of me
select the last line of me
else
put MoveTxt & return before line CurLinPtr of me
select line CurLinPtr of me
end if
end if
end MouseStillDown
Rich
Payne Sparkman Mfg.
shop at paynesparkman.com
----- Original Message -----
From: "Ray Horsley" <ray at linkitonline.com>
To: <metacard at lists.runrev.com>
Sent: Thursday, April 18, 2002 12:31 PM
Subject: Dragging Lines in a Field
> Does anybody have a solution for dragging lines up and down in a field to
> resort them?
>
> Thanks,
>
>
> Ray Horsley
> Developer, LinkIt! Software
>
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard
More information about the metacard
mailing list