Sending mouseUp

Peter Haworth pete at lcsql.com
Wed Mar 20 12:20:59 EDT 2013


Thanks for the suggestions everyone.  Here's where I'm at.

Craig:
I moved the code to openCard, still the same problem.

Mike:
wait zero didn't fix it, nor did send in time with full path.

Mark:
Restructuring the code does, of course, work and is probably going to have
to be my workaround. The reason I didn't really want to do that is that the
mouseUp event can be sent to one of 7 buttons (it's all to do with the
user's startup preference settings) so there's a significant amount of code
to be moved around but it's looking like I may have to.

In general, it seems that using preOpenCard on the main stack just isn't
reliable.  I remember in another project I had to move ALL of my
preOpenCard processing into a separate handler and call it from preOpenCard
with a wait zero before it.  Without that structure, the code would just
stop executing at what looked like a pretty harmless statement
without throwing any type of runtime error.

Pete
lcSQL Software <http://www.lcsql.com>


On Tue, Mar 19, 2013 at 9:46 PM, Mark Wieder <mwieder at ahsoftware.net> wrote:

> Pete-
>
> Tuesday, March 19, 2013, 6:47:33 PM, Craig wrote:
>
> > Something like this has come up before. I remember that
> > "preOpenCard" is invoked before the card (and the stack?) is even
> > loaded into memory. I think. So there may be no valid target handler
> > yet available to access. Why the "handled" value is set is odd, for
> > sure, but I bet the answer is tangled up with the fact that these
> > events are happening just a tad too early, before things have
> > settled down.
>
> Yep. Why are you trying to call a mouseUp handler on preOpenCard
> anyway? Take the code in mouseUp, put it in its own handler, and call
> it from mouseUp. Then call the same thing from preOpenCard.
>
> -- in button script
> on mouseUp
>   doTheStuffThatUsedToBeHere
> end mouseUp
>
> on doTheStuffThatUsedToBeHere
>   stuffThatUsedToBeHere
> end doTheStuffThatUsedToBeHere
>
> -- in card script
> on preOpenCard
>   dispatch "stuffThatUsedToBeHere" to button "yaddayadda"
> end preOpenCard
>
> --
> -Mark Wieder
>  mwieder at ahsoftware.net
>
>
> _______________________________________________
> 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