A possible messaging and modal dialog bug...

J. Landman Gay jacque at hyperactivesw.com
Fri Feb 26 18:10:16 EST 2016


On 2/26/2016 4:08 PM, Paul Dupuis wrote:
> What is unexpected is that the answer statement in the script of btn 2
> is NEVER executed! This seems like a BUG.
>
> What must be happening is that when the answer dialog is up (from btn 1)
> and equivalent of 'wait with messages" is occuring, so btn 2 then gets
> the "dataChanged" message from the pendingMessages and starts to
> execute.

I think so too. Pending messages occur when an idle event happens, and a 
dialog waiting for a response would have those.

> The puzzling behavior is that when the script of btn 2 gets to
> the answer statement, presumably because the answer dialog is already
> open, it just continues to the next statement. This seems wrong to me.

I think it has to be that way because you can only have one modal open 
at a time, and the LC dialog is a stack. When the second command is 
sent, it would be the same as a "go stack x" when stack x is already 
open -- nothing changes.

When a LC dialog is called, the dialogData global is populated and the 
dialog stack fills in its fields with the content of the dialogData on 
preOpenCard. So I suspect that the dialogData is being changed, but 
since the dialog is already open, the preOpenCard message isn't sent and 
the fields do not re-populate. It looks like nothing has changed, since 
only the dialogData global is different, and gives the impression that 
the command was skipped.

> I have not tried this with, say my own modal dialog using the 'modal'
> command. I wonder if the same problem exists.

I'm pretty sure you'd get identical results unless you can populate the 
dialog fields some other way (in which case you'd lose the user's first 
response) or if you put up multiple modals at the same time. That's a 
recipe for trouble though.

One fix for your handler would be to avoid "send in <time>" and put the 
dialog commands serially into a handler. That way it will wait until the 
first one closes, then re-open the second one.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list