Sending mouseUp

Paul Hibbert lc at pbh.on-rev.com
Wed Mar 20 17:04:50 EDT 2013


Out of curiosity I created a simple stack with one card and four buttons named "Button 1" though "Button 4", each button just had the script;

on mouseUp
   answer the short name of me
end mouseUp

then I put the following in the stack script;

on preOpenStack
   testMessage1
end preOpenStack

on openStack
   testMessage2
end openStack

on preOpenCard
   testMessage3
end preOpenCard

on openCard
   testMessage4
end openCard

on testMessage1
   send "mouseUp" to btn 1
end testMessage1

on testMessage2
   send "mouseUp" to btn 2
end testMessage2

on testMessage3
   send "mouseUp" to btn 3
end testMessage3

on testMessage4
   send "mouseUp" to btn 4
end testMessage4

After building the app and launching it I received the following 4 answers;

Button 1
Button 3
Button 2
Button 4

Answers to Buttons 1 & 3 appeared before the card was visible, answers to Buttons 2 & 4 appeared after the card appeared.

Tried with the preOpenCard & openCard handlers on the card script too, with exactly the same result.

Maybe this is over simplifying things a little, but it shows that messages are sent from preOpenStack/Card and received by the buttons, so I would imagine there is something else at the heart of the issue in this case.

Paul

On 2013-03-20, at 2:00 PM, Peter Haworth wrote:

> Hi Craig,
> You're right that the button wasn't fully qualified initially, but no error
> was thrown.  That's another problem I've come across in preOpenCard - often
> errors just don't get thrown.  Plus red dot break points don't trigger
> (although a breakpoint command does).
> 
> All in all, preOpenCard is a weird and strange environment.  I plan to
> avoid it wherever possible in the future.  In the project with the current
> issue, preOpenCard consist of a "hide stack" command and I've moved all my
> processing to openCard with a "show stack" command at the front (thanks to
> Geoff Canyon for that technique).  I hate to have to resort to that type of
> trickery but I've spent way too much time debugging preOpenCard issues in
> the past.
> 
> 
> On Wed, Mar 20, 2013 at 1:33 PM, <dunbarx at aol.com> wrote:
> 
>> As I understand from Peter's original post, he did not send the message to
>> an explicitly identified button, which I assume would indeed have thrown an
>> error. Or at least it should have.
> 
> 
> 
> 
> Pete
> lcSQL Software <http://www.lcsql.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