Location of dialog box

Wilhelm Sanke sanke at hrz.uni-kassel.de
Fri Nov 18 11:56:37 EST 2011


On Fri,  Nov 18 , 2011, James Hurley jhurley0305 at sbcglobal.net wrote:

> Ken and Malte,
>
> Thanks for the suggestions.
>
> Malte--Your suggestion works well. Thanks. As you say it is a bit of a 
> hack.
>
> Ken--I was referring to the stack that opens in response to the RR 
> "Answer" command. Is it possible to set a preopencard handler in that 
> stack?
>
> But using a modal stack as you suggest, I can roll my own "answer" 
> dialogue. This would give me more flexibility. I assume many others 
> take this route.
>
> Thanks, again,
>
> Jim Hurley 


  I might remind you - and especially Ken as the present chief of the 
Metacard group - that we have long implemented such a feature for the 
ask and answer dialogs in the alternative Metacard IDE, following a 
proposal from my side several years ago.

At the end of the preopenstack handler of the dialog stack (in the card 
script) we have added two lines of code:

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

In the script calling the dialog you have just first to set the "Newloc":

"set the newloc of stack "answer dialog" to x,y"

or use globalloc alternatively.

The second line of code above "set the NewLoc of this stack to empty" 
makes sure the dialog will pop up at the "normal" loc when no Newloc has 
been set before calling the dialog.

This approach is so simple! I have always wondered why the Livecode guys 
did not include such a simple solution in the Livecode IDE, too.--

These two line of extra code could of course be added to the 
revanswerdialog etc., too, but then, when you distribute a 
non-standalone stack, without prior including the answer dialog as a 
substack, it will not work with the Livecode IDE of another user. On the 
other side, with an answer dialog embedded as a substack you might run 
into troubles, because the Livecode IDE is very special with double 
stacks and might throw an error (Did not test this with the last version).

Best regards,

Wilhelm Sanke







More information about the use-livecode mailing list