Abort a message dialog from a timer - possible?

  1. last week

    Tim S

    May 11 Canterbury, UK

    I want a thread to put up a messagedialog before it embarks on a lengthy bit of work. Equally, I want this to run unattended so that after some period such as 20 secs, a timer "clicks" the OK button and the thread continues.

    Is there a cross-platform way to do the timer part?

  2. Dave S

    May 11 San Diego, California USA

    I think the only (best) way to do that is a custom dialog box where you can control the close method directly

  3. Hal G

    May 11 Pre-Release Testers, Xojo Pro, XDC Speakers CampSoftware.com

    I just did what Dave suggested and it worked out great! Mine was for PDF creation. When the user clicks a button to create the PDF, I show the Dialog with an infinite progress bar, create the PDF, close the Dialog, then show the PDF. I'm used to thinking and working synchronously, but this concept is asynchronous.

    Essentially:

    • Create a Dialog with an IsRunning and IsDone boolean properties both defaulted to No.
    • Add a Button to the Dialog that sets IsRunning to true, disables the Button, and starts your process on Clicked.
    • Add a 20 sec Single Timer to the Dialog that sets isRunning to true, disables the Button, and starts your process if IsRunning is False
    • Add a 1 sec Multiple Timer to close the Dialog when IsDone is True.
    • When the process is done, set IsDone to True.
  4. Tim S

    May 11 Canterbury, UK

    Looks like I'll have to roll my own then, thx.

or Sign Up to reply!