Consultor Eletrônico



Kbase P12474: Is it possible to position an ALERT-BOX explicitly
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/10/2008
Status: Unverified

GOAL:

Is it possible to position an ALERT-BOX explicitly

FIX:

Unfortunately ALERT-BOXes cannot be positioned explicitly, as Windows has control over that.

However, it's possible to write a program where a DIALOG-BOX looks like an ALERT-BOX. DIALOG-BOXes can be placed explicitly anywhere on the screen.

The following is a very rough demonstration of what just stated:

/* pseudoAluertBox.p */
DEF INPUT PARAM pMessage AS CHAR.
DEF INPUT PARAM pTitle AS CHAR.
DEF INPUT PARAM pRow AS DECI.
DEF INPUT PARAN pCol AS DECI.

DEF BUTTON bOk LABEL "OK" AUTO-GO SIZE-PIXELS 75 BY 23.

FORM pMessage FORMAT "x(50)" VIEW-AS TEXT
AT ROW 2 COL 3
bOk AT ROW 4 COL 25
WITH FRAME pseudoAlertBox
SIZE 65 BY 5.5
NO-LABELS
THREE-D
TITLE pTitle
VIEW-AS DIALOG-BOX
ROW pRow COLUMN pCol
DEFAULT-BUTTON bOk.

ON WINDOW-CLOSE OF FRAME pseudoAlertBox DO:
APPLY "CHOOSE" TO bOk IN FRAME pseudoAlertBox.
RETURN NO-APPLY.
END.

DISPLAY pMessage WITH FRAME pseudoAlertBox.
DO ON ERROR UNDO, LEAVE
ON ENDKEY UNDO, LEAVE:
UPDATE bOk WITH FRAME pseudoAlertBox.
END.

The look'n'feel of this sample is not exactly the same as an ALERT-BOX, but it has the same functionality.
You can enhance it to allow for other buttons (for example: Yes, No, Cancel), multi-line messages, and add code to size the DIALOG-BOX dynamically based on the text displayed.