Location of dialog box

Ken Ray kray at sonsothunder.com
Fri Nov 18 13:39:41 EST 2011


> 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?

Yes, but for the reasons that Wilhelm wrote you wouldn't be able to distribute a raw stack to someone else and have it work right in their IDE.

I *DO*, however, have a workaround to this that seems to work in my tests:

1) In your stack create a hidden button (I called mine "AnswerLoc") with this script:

global gAnswerLoc
on preOpenCard
   if the short name of this stack is "Answer Dialog" then
      if gAnswerLoc is not empty then
         set the loc of stack "Answer Dialog" to gAnswerLoc
         put "" into gAnswerLoc
      end if
   end if
   pass preOpenCard
end preOpenCard

2) Sometime before you call on "answer" for the first time, insert the script of that button "into front" to make it a frontScript:

insert script of btn "AnswerLoc" into front

3) When you're ready to call on "answer", set the global gAnswerLoc to the loc you want the answer dialog to appear at, and then call "answer":

global gAnswerLoc
on mouseUp
   put "100,100" into gAnswerLoc
   answer "Hello"
end mouseUp

This will give you the desired effect, it cleans up after itself nicely, and is completely distributable.


Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/	




More information about the use-livecode mailing list