Release 10.1A: OpenEdge Development:
Progress 4GL Reference

> ## LAST-EVENT system handle

> A handle to the last event the application received.

> #### Syntax

>     LAST-EVENT [ :attribute ]

> ``attribute``

> An attribute of the LAST-EVENT.

> #### Attributes

> CODE attribute | COLUMN attribute | EVENT-PROCEDURE-CONTEXT attribute
> FUNCTION attribute | LABEL attribute | ON-FRAME-BORDER attribute
> ROW attribute | TYPE attribute | WIDGET-ENTER attribute
> WIDGET-LEAVE attribute | X attribute | Y attribute

> Example

> This procedure creates a variety of widgets and a frame that acts as a message area. As you move around the widgets the procedure tells you what events Progress generates.

> r-lstevt.p
>     DEFINE VARIABLE msg_watcher AS CHARACTER FORMAT "x(50)" NO-UNDO.
>     DEFINE VARIABLE fi AS CHARACTER FORMAT "x(50)" LABEL "Fill-in" NO-UNDO.
>     DEFINE VARIABLE edit AS CHARACTER VIEW-AS EDITOR SIZE 10 BY 2 NO-UNDO.
>     DEFINE BUTTON exit AUTO-GO LABEL "Go to Exit".
>     DEFINE BUTTON test LABEL "Test" SIZE 15 BY 3.

>     DEFINE VARIABLE txt0 AS CHARACTER FORMAT "x(75)" NO-UNDO.
>     DISPLAY "Feel free to move around..." VIEW-AS TEXT
>          SKIP fi SKIP (0.1)
>          edit AT 2 SKIP (0.1)
>          test AT 10
>          exit AT 50 SKIP (0.5)
>        WITH FRAME f SIDE-LABELS.

>     DISPLAY txt0 LABEL "LAST-EVENT:LABEL FUNCTION (TYPE) > SELF:TYPE LABEL"
>     WITH FRAME report 4 DOWN CENTERED TITLE "Messages".
>     ON RETURN, TAB, ANY-PRINTABLE, GO ANYWHERE
>        RUN msgwatch. /* This procedure uses LAST-EVENT. */

>     ENABLE ALL WITH FRAME f.
>     WAIT-FOR GO OF FRAME f FOCUS fi.
>     PROCEDURE msgwatch.
>        txt0 = LAST-EVENT:LABEL + " " + LAST-EVENT:FUNCTION + " [" +
>               LAST-EVENT:EVENT-TYPE + "]-->" + SELF:TYPE + " ".
>        IF CAN-QUERY(SELF, "LABEL")
>        THEN txt0 = txt0 + SELF:LABEL.
>        ELSE txt0 = txt0 + STRING(SELF).

>        DISPLAY txt0 WITH FRAME report.
>        DOWN WITH FRAME report.
>     END PROCEDURE.

> #### Notes

> - For keyboard events, the CODE, FUNCTION, and LABEL attributes return the key code, key function, and key label of the event, respectively. For all other events the CODE attribute returns the numeric event code.

> For mouse events, the FUNCTION attribute returns the names of portable mouse events and the LABEL attribute returns the names of three-button mouse events.

> For high-level Progress events, the FUNCTION attribute returns the name of the event. If the Progress event is triggered by a key press, the LABEL attribute returns the key label. Otherwise, it returns the event name, as with the FUNCTION attribute.

> - The EVENT-TYPE attribute returns the category of the event: KEYPRESS, MOUSE, or Progress.

> - The ON-FRAME-BORDER attribute indicates whether a MOUSE event occurred in the border of a frame.

> - The TYPE attribute returns the widget type, PSEUDO-WIDGET.

> - The X and Y attributes return the pixel position of a MOUSE event relative to the current frame.

> - For browse widgets, WIDGET-ENTER and WIDGET-LEAVE are different depending on whether the browse is editable or read-only. For editable browse widgets, WIDGET-ENTER contains the widget handle of the column with focus. For read-only browse widgets, WIDGET-ENTER contains the widget handle of the browse. For editable brows widgets, WIDGET-LEAVE contains the widget handle of the column the user just left. For read-only browse widgets, WIDGET-LEAVE contains the widget handle of the field-level widget the user just left.

> #### See also

> LIST-EVENTS function, LIST-WIDGETS function, SAX-reader object handle, VALID-EVENT function

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095