Modal dialog not modal... any hints?

Tereza Snyder tereza at califex.com
Wed Jan 20 08:50:21 EST 2010


I originally reported:

>>>> The stack "AskYesOrNo" is intended to do what you'd expect: it displays the question with "yes" or "no" and returns "yes" or "no" in the dialog data. However, when I call this handler, it returns empty before it even displays the dialog. If I insert a "put" statement AFTER the "modal" statement, the putted text is visible in the message box while the dialog is on the screen, and statements in the caller of the YesOrNo function are executed before I exit the dialog.
>>>> 
>>>> In other words, "modal" seems broken. Before I start making test stacks, has anyone encountered this before? Could there be a bug in the dialog scripts that causes the dialog to fail silently?
>>> 

Jacques wrote:
> 
>> Do you have something else than filling fields with the custom properties and setting the dialogData in the scripts of "AskYesOrNo" ?

so I wrote:
> 
> 
> In preopenstack I move buttons around to suit the platform and default value, and I arrange to return the default value on returnkey. But I do nothing unusual. I've had to revert to using an answer dialog--which works--but I wish my own dialog would work! This is old code that worked for years that I revived for this project (I wanted my own look-and-feel). Convinces  me I really AM losing my grip!

Phil Davis wrote:

> So you call YesOrNo() from preOpenStack? If so, I bet that's the problem. Hide your mainStack in preOpenStack, and call AskYesOrNo() in openStack (after the stack window has been drawn, even if invisible). And before calling AskYesOrNo() be sure the modal stack is visible.

I didn't report clearly that the preopenstack handler in question is in the dialog. The YesOrNo() function is called in the course of normal business ("Are you sure you want to set xx to yy?").

Malte wrote:

> is your stacks visible false by chance? If you call a modal stack that is hidden (visible set to false by any script) it closes immediately.

The problem isn't that it closes immediately, but that execution continues past the modal statement even while the dialog is visible awaiting input. If I do this:

> modal "AskYesOrNo"
> put "back from dialog"

I can see "back from dialog" in the message box while the modal stack is still awaiting input.

Klaus contributed, about an app he wrote:

> I saw the "Answer dialog" flashing and the app quit, without leaving time to click the "OK" button!
> NOTHING else involved that could have caused this anomaly!
> 
> Unfortunately this is not reproducable, but it happens, which makes it difficult to stay mentally sane :-D

And I agree!



On Jan 20, 2010, at 5:11 AM, Jacques Hausser wrote:

> Hi Tereza
> 
> That explains nothing, but could perhaps be an ad hoc solution (since I cannot reproduce the problem, I cannot test it). Try to modify your script as follows:
> 
> function YesOrNo pQuestion, pDefaultAnswer
>  set the dialogData to empty -- to be sure
>  set the Question of stack "AskYesOrNo"  to pQuestion
>  set the DefaultAnswer of stack "AskYesOrNo" to pDefaultAnswer
>  modal "AskYesOrNo"
>  wait until the dialogData <> empty	
>  return the dialogData
> end YesOrNo
> 
> ... I cross my fingers


I will try this approach and see if it works, as I attempt to isolate the problem today. At least, using an answer dialog, I was able to release the standalone for testing yesterday.

Thanks to all for the input.

from crazyland,

tereza




-- 
Tereza Snyder
Califex Software, Inc.
<www.califexsoftware.com>







More information about the use-livecode mailing list