close the answer dialog from script

Ken Ray kray at sonsothunder.com
Fri Aug 24 13:48:47 EDT 2007


On Fri, 24 Aug 2007 16:26:07 +0200, paolo mazza wrote:

> Thanks for your help. I tryed to use the command
> 
> close stack "Answer Dialog"
> 
> Actually it closes the answer dialog but unfortunately the
> 
> exit to top 
> 
> command in the following line  does not work and the it does not stop.

What you need to do is set a flag in your closeAnswerDialog handler 
that can be checked after the answer dialog line has been executed. 
Since it's modal, once it closes, it will continue processing lines of 
code after the "answer" command.

So you can do this:

global TempoIniziale,gTEMPOCONTROL,gBailOut
on mouseUp
 put false into gBailOut
 put the seconds into TempoIniziale
  ControlloTempo
  answer "You are great" with "OK" and "Annulla"
  if gBailOut then exit to top
  if it is "OK" then
    put "1" into message
  else
    put "2" into message
  end if	
end mouseUp

on ControlloTempo 
  put the seconds into TEMPO2
  -- put TEMPO2 && TempoIniziale  & return after  message
  if (TEMPO2 - TempoIniziale) > 4 then
    put true into gBailOut
    close stack "Answer Dialog"
    exit to top
  else
    send "ControlloTempo" to me in 2 seconds
    put the result into gTEMPOCONTROL
  end if
end ControlloTempo

Try that...

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