New Locs for old dialogs (was: Re: Modal Box)

Wilhelm Sanke sanke at hrz.uni-kassel.de
Thu May 1 18:18:01 EDT 2003


 Sometimes when you try to improve a workaround you lose sight of nearly
obvious better solutions.

First concerning  the workarounds:

On Mon, 28 Apr 2003  Jim Hurley <jhurley at infostations.com> wrote:

(snip)

> Wilhelm,
>
> Did you also comment the line:
>
> if the platform is "MacOS" then set the top of this stack to
> round(item 4 of the screenRect/5)
>
> It appears at the very end of the preopenstack script in answer dialog.
>
>
(snip)

Thanks, I eventually noticed it.


On Tue Apr 29 18:08:01 2003 Sarah wrote

(snip)


> Thanks for the demo stack, I had a look but I guess I'm just lazy. What
> I really want is to be able to substitute my dialog stacks for the
> defaults without having to change any script commands i.e. just have
> ask & answer point to my stacks instead. I reckon this should work if I
> just edit the Rev stacks in place (after making backups).
>
> One oddity which I did solve was the problem of setting the loc of the
> modal window without it flashing up in the wrong place to start with.
> In your ask demo, you open the window, set it's loc and then change it
> to modal. Even though the screen is locked, I can see it after it has
> moved but before it becomes modal (you can see the background pattern
> change). I changed part of your script as follows:
>
>    go invisible to stack "question"
>    set the loc of stack "question" to ModalLoc
>    modal "question"
>    unlock screen
>    show stack "question"
>
> This made it open, move and change mode without showing any
> intermediate steps.
>
> Cheers,
> Sarah
> sarahr at genesearch.com.au
>

Sarah,

Concerning the "lazyness": I think there are many situations where you
need a customized modal dialog with an application. And to develop your
custom dialog would not require more effort than to produce your
application.

Your above sequence of script lines indeed avoids the flash I noticed,
too, on my G 4 Mac - nearly unnoticeable under Windows - but has the
disadvantage that the dialogdata will not be returned to the stack that
triggered the dialog. Same thing if you use custom properties instead of
the dialogdata. You have to put the line "show stack question" before
the line "modal question" to work properly,- and then the flash is there
again.

The new solution I stumbled across:

Do not open the dialog twice; instead

set a custom property of the respective dialog stack from the calling
script

"set the NewLoc of stack "answer dialog" to 300,400" # or whatever,

and add a script line in the dialog stack, like

"if the Newloc of this stack is not empty then set the loc of this stack
to the NewLoc of this stack".-

This works for both Mac and Windows platforms and for Revolution as well
as for Metacard.

No need even to comment the respective lines of the answer dialog of the
Mac version of Revolution that define the loc as long you add the above
line "if the Newloc....." just before "end preopenstack".

I will adjust my sample stacks on our FTP server.

Enjoy setting any locs for modal dialogs without flashing and for any
platform.

Regards,

Wilhelm Sanke




More information about the use-livecode mailing list