A possible messaging and modal dialog bug...

Paul Dupuis paul at researchware.com
Fri Feb 26 14:32:08 EST 2016

I what seems to me is a "bug" related to messages and model dialogs in
LiveCode. I have tested this under LC676, LC7.1.1, and LC8.0.0dp15

If I have stack with 2 buttons, called Dialog1 and Dialog2 with the
following script in each button.

on dataChanged
  put short name of me & colon & cr & "BEFORE DIALOG" & cr after fld 1
  answer "Message Received by"&& short name of me && "at"&&the milliseconds
  put short name of me & colon & cr & "AFTER DIALOG" & cr after fld 1
end dataChanged

A single scrolling field to see results (fld 1) and a 3rd button with a

on mouseUp
  send "dataChanged" to btn 1 in 5 milliseconds
  send "dataChanged" to btn 2 in 10 milliseconds
end mouseUp

When you click on the 3rd button, button 1 receives the dataChanged
message, places the data and "BEFORE DIALOG" note in the field and then
presents the answer dialog and suspends pending the dialog.
While button 1's modal dialog is still waiting for a user action, button
2 gets its dataChanged message, places the short name and it's BEFORE
DIALOG note and the skips its answer dialog and places its (button 2)
AFTER DIALOG message and exits.
Then when the visible Answer dialog is responded to from Button 1's
script, button 1 places its "AFTER DIALOG note in the field.

This is counter to what I would expect. I would have expected EITHER:
the script in button 2 to have suspended as soon as it received its
message and not executed until the answer dialog from button 1 was
responded to
the script in button 2 to have suspended when it reached the answer
statement and when the answer dialog from button 1 was complete, then
you would get the answer dialog from button 2.

The fact Livecode SKIPs a line of code (the answer statement in button
2) with no error or warnings or anything I find disturbing?

Is this a BUG or an expected behavior? If there any way to ensure any
dialog in a message executed in time while another dialog is pending
does not get skipped?

More information about the use-livecode mailing list