0

How to auto close a alert box without user intervention.

Programatically want to close the alert box.

jdpjamesp
  • 762
  • 7
  • 19
Saroj
  • 25
  • 4
  • Possible duplicate of [Programmatically close alert() in Javascript](http://stackoverflow.com/questions/23485086/programmatically-close-alert-in-javascript) – Borja Tur Jul 13 '16 at 12:19

2 Answers2

2

You can't. You will have to implement your own dialog with a timer. The dialog your build must fit your UI: ABL GUI, GUI for .NET or TTY

Mike Fechner
  • 6,627
  • 15
  • 17
2

I'll assume it's Windows, because otherwise, Mike's answer is completely true. The only form I can think of doing this is having it expire over time.

I've messed a little and found this. Just tested, and it works. 2000 is the time in miliseconds you want the message to wait before it expires. Mess with the '3' parameter to see other button choices (So far I've found 0 to 6 works). Hope this helps.

PROCEDURE MessageBoxTimeoutA EXTERNAL "user32.dll":
    DEFINE  INPUT PARAMETER hwnd            AS LONG      NO-UNDO.
    DEFINE  INPUT PARAMETER lpText          AS CHARACTER NO-UNDO.
    DEFINE  INPUT PARAMETER lpCaption       AS CHARACTER NO-UNDO.
    DEFINE  INPUT PARAMETER uType           AS LONG      NO-UNDO.
    DEFINE  INPUT PARAMETER wLanguageID     AS LONG      NO-UNDO.
    DEFINE  INPUT PARAMETER lngMilliseconds AS LONG      NO-UNDO.
    DEFINE RETURN PARAMETER ans             AS LONG      NO-UNDO.
END PROCEDURE.
DEFINE VARIABLE i AS INTEGER     NO-UNDO.
RUN messageBoxTimeoutA (0, "Test","test2", 3 , 0, 2000, OUTPUT i ).

DISPLAY i.

My example has buttons yes-no-cancel. The value of i will be 6 for yes, 7 for no, 2 for cancel and 32000 if timeout.

bupereira
  • 1,463
  • 8
  • 13