Pseudo Drag and Drop question
gjbalzano at popmail.ucsd.edu
Fri Feb 25 12:26:01 CST 2005
Thanks Alex and Wilhelm, for your assistance with my problem. I'm off
and running now (up to the next obstacle?).
Wilhelm, I don't know how I missed your post from Feb 6; it's clearly
relevant. I appreciate your re-posting for my benefit.
Happy scripting/designing/creating to all you Rev users out there,
On Feb 24, 2005, at 3:25 AM, Alex Tweedly wrote:
>> I mainly want to know, am I right about this, that there is no easier
>> better way?
> I don't know (for sure) that there isn't an easier way - but it sounds
> like you've done a diligent search and not found one yet, so it may be
> time to go ahead with this way.
> Earlier, you said:
>> I foresee this "solution" scaling badly as the number of controls on
>> the card increases.
> You could help the scaling performance by
>> to (p)
>> manage a list of potential target-controls and (q) iterate over it
>> until I
>> find one with the mouseLoc (or some such) enters the rect of it.
> Rather than a list of controls, and checking against the rect of it,
> I'd keep a list of rectangles, as in
> x1, y1, x2, y2, "long name of the control"
> Then a check that said
> on mouseMove newx, newy
> if abs(newx-gLastX) < 10 and abs(newy-gLastY) < 10 then return
> repeat for each line L in gControlList
> if item 1 of L < newx and newx < item 3 of L and .... etc.
> end repeat
> end mouseMove
> would be pretty quick. Only checking when the delta is big enough is a
> help - and running through a list like this would be quick.
> In the unlikely case you do run into performance issues (because you
> had hundreds or thousands of such controls), you could use some of the
> fancy geometric sorting techniques to allow you to only check against
> relatively few of them
On Feb 24, 2005, at 2:05 AM, Wilhelm Sanke wrote:
> On Feb 6 I responded to a similar question by Jonathan Lynch. Maybe
> the suggestion below could be of use for you?:
> You could try something like the handler below in the script of the
> dragged control:
> "on mousedown
> set the layer of me to top
> grab me
> put the number of graphics into Gnumber
> repeat with i = 1 to Gnumber
> if intersect(me, grc i) then
> put the name of grc i
> # or do whatever you want
> end if
> end repeat
> send "mousedown" to me in 100 milliseconds
> end mousedown"
> The last line does the trick.
More information about the use-livecode