Drag and Drop

Peter Haworth pete at mollysrevenge.com
Mon Feb 7 21:12:09 EST 2011

On Feb 7, 2011, at 5:29 PM, J. Landman Gay wrote:

> On 2/7/11 7:07 PM, Peter Haworth wrote:
>> And, as someone else pointed out, the mouseStack
>> property does NOT correctly report the name of the stack that the
>> mouse is over unless you are in a mouseUp handler, or at least it
>> didn't in Scott's handler. Sorry to keep harping on this, but the
>> dictionary, yet again, is flawed.
> If that's so, then it sounds like the mousestack property is only updated on idle. I know that's true of lots of other properties. If your dragging handler uses a "repeat until the mouse is up" structure, you aren't giving any time to the engine and lots of things won't get updated. It's a good argument for using "send" instead. Repeat loops are slow and memory hogs too.
> <http://www.hyperactivesw.com/polling.html>

Yes, that's essentially what it does although it's not really my script, it's Scott's :-)  I'll probably leave it as it is for now and take the performance hit - I'll probably break it if I mess with it! 
>> I found the IDE code that handles the drag and drop of controls from
>> the Tools palette. It figures out which stack the mouse is over by
>> comparing the mouse location to the rectangle of each open stack.  So
>> I did the same thing and it works fine.  I hope I'm not breaking any
>> intellectual property laws.
> Nope, it's not only fine, it's encouraged. That's why RR leaves the scripts unlocked. It's a great way to learn.

I was wondering about that, glad it's OK!
>> I'm left with one strangeness.  As a control is being dragged, it has
>> a blue background. After it is copied to the new stack, it still has
>> a blue background until I click on it, then it goes back to the
>> background of the original control.  I noticed that happening in
>> Scott's script (except it's green instead of blue).  Not a big deal
>> but Scott, wondering if you might have a fix for that?
> If a script sets any properties of the template object, then all new controls of that type will also use those properties until the template is reset. Use "reset the template<whatever>" before creating a new control to revert it back to the default values. I.e., for a field, "reset the templatefield".

Scott's script use templateStack and templateImage but he resets those.  My testing has been done with a button so far and I don't see anywhere where the templateButton is used.  I tried resetting it anyway, but still the same result.  Would be nice to figure out what's happening but it's not a big concern.
> -- 
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

More information about the Use-livecode mailing list