Dismissing answer dialogs after xxx seconds automatically

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Dismissing answer dialogs after xxx seconds automatically

Post by andyh1234 » Wed Nov 06, 2013 6:50 pm

If there any way to automatically dismiss an answer dialog box after xxx seconds.

I realise I can create a separate stack / card and show it, then have it dismiss itself after xxx seconds, but it seems like I would have to add lots of extra code to get the custom stack to show in a viable place, resize itself to the contents of the message etc etc and I'm just wondering if its possible at all to add code to have the existing answer dialog box close without user input.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Dismissing answer dialogs after xxx seconds automaticall

Post by Klaus » Wed Nov 06, 2013 7:12 pm

Hi Andy,

just created a button with this script and it worked :D

Code: Select all

on mouseUp

  ## Important part to send BEFORE the dialog ;-)
  send "closeit" to me in 2 secs
  answer "sfasdfasdfasdfasdf"
end mouseUp

command closeit
  close stack "Answer Dialog"
end closeit
You get the picture!

Best

Klaus

andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Re: Dismissing answer dialogs after xxx seconds automaticall

Post by andyh1234 » Wed Nov 06, 2013 7:29 pm

Thanks Klaus!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Dismissing answer dialogs after xxx seconds automaticall

Post by dunbarx » Wed Nov 06, 2013 10:08 pm

Klaus.

Nice.

I love the fact that everything in LC is a stack. Try doing that in HC.

Craig

MWCoastMedia
Posts: 32
Joined: Fri Jan 16, 2015 5:31 pm

Re: Dismissing answer dialogs after xxx seconds automaticall

Post by MWCoastMedia » Fri Apr 19, 2019 8:08 pm

Klaus wrote:
Wed Nov 06, 2013 7:12 pm

Code: Select all

on mouseUp
  ## Important part to send BEFORE the dialog ;-)
  send "closeit" to me in 2 secs
  answer "sfasdfasdfasdfasdf"
end mouseUp

command closeit
  close stack "Answer Dialog"
end closeit
When attempting this on iOS, Livecode throws error codes 91 (chunk: can't find stack) and 108 (close: can't find stack).

Since there is only 1 stack when deploying to mobile, is the only option for something like this to create your own modal rather than using the "answer" command?

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Re: Dismissing answer dialogs after xxx seconds automatically

Post by SparkOut » Fri Apr 19, 2019 8:52 pm

You might see if "toast" widgets are a possible option for mobile?

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Dismissing answer dialogs after xxx seconds automatically

Post by [-hh] » Sat Apr 20, 2019 9:03 am

You could also have a look on AlertBuilder, works in LC 6/7/8/9.
See the description here
viewtopic.php?p=143920#p143920
and/or download from (sorry, currently not available)
Last edited by [-hh] on Wed Dec 11, 2019 11:47 pm, edited 1 time in total.
shiftLock happens

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Re: Dismissing answer dialogs after xxx seconds automatically

Post by SparkOut » Sat Apr 20, 2019 9:33 am

I might have known to suggest checking one of Hermann's nifty stacks first!
Vielen Dank wieder, [-hh]

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Dismissing answer dialogs after xxx seconds automaticall

Post by Klaus » Sat Apr 20, 2019 1:26 pm

Hi MWCoastMedia,
MWCoastMedia wrote:
Fri Apr 19, 2019 8:08 pm
Klaus wrote:
Wed Nov 06, 2013 7:12 pm

Code: Select all

on mouseUp
  ## Important part to send BEFORE the dialog ;-)
  send "closeit" to me in 2 secs
  answer "sfasdfasdfasdfasdf"
end mouseUp

command closeit
  close stack "Answer Dialog"
end closeit
When attempting this on iOS, Livecode throws error codes 91 (chunk: can't find stack) and 108 (close: can't find stack).

Since there is only 1 stack when deploying to mobile, is the only option for something like this to create your own modal rather than using the "answer" command?
You are six years late for the party! :-)

On the desktop/standalones and in the IDE the ASK and ANSWER dialogs are in fact STACKS, but not on mobile!
Here the underlying OS supplies the dialogs and we cannot control them from within LC.

I would create a GROUP which covers the complete card to FAKE an answer dialog, know what I mean?


Best

Klaus

Post Reply