@Source: Event and Screen
Statements exclusive to Screen files.
Event
Event StandardName
...
EndEvent
Event 'Label' KeyNumber
...
EndEvent
Two forms: standard event (bare, unquoted name) or a custom event attached to a function key (quoted name + key number, 1-24, i.e. F1-F24; F13-F24 via Shift).
Standard events
| Event | When it fires |
|---|---|
Enter | On pressing Enter (with no function key active). CurrentInput() identifies which Input had focus, decoded from the cursor position after EXFMT. |
Close | Fixed to F3 in the generated DSPF (CF03) — always runs (even empty) and ends the screen; doesn’t require a declaration to attach the key. |
Load | Once, before the first display — typically contains the For Each/LoadRow() that fills the DataGridView. Page Up/Down are native scrolling over what’s already loaded; this event never runs again. |
Refresh | On pressing F5, if F5 is declared in the .warpcfg’s @FunctionKeys and isn’t taken by a custom Event 'Name' 5. |
Init | Once, the first time this screen starts, before the first display. Does nothing if not declared. The only place in a Screen where Member(...) is valid — see Reports with Member()/Export(). |
Custom events
Event 'FindCustomer' 4
Message("F4 was pressed", Info)
EndEvent
The label shown in the screen’s attention line is configured in the project’s .warpcfg @FunctionKeys (see Project), not in the Event itself.
Message
Message(text, Error|Warning|Info)
Shows a message on the screen’s message line: Error (red), Warning (yellow), Info (normal text color). Shown on the next screen refresh and cleared after one cycle.
LoadRow / RefreshSelectRow / For Each Row
Exclusive to screens with a DataGridView — see the full guide: DataGridView.
| Statement | Use |
|---|---|
LoadRow() | No arguments. Takes the current values of the variables bound to each Column and appends a row to the grid. Only valid inside a For Each in the body of Event Load (that For Each must declare Index). |
RefreshSelectRow() | No arguments. The reverse of LoadRow(): re-reads the row under the cursor and writes each column (including Hidden ones) back into its bound variable. Valid in any Event of a Screen with a DataGridView. |
For Each Row ... EndFor | Iterates over every row already loaded into the subfile (not the table), writing each Column into its bound variable before every iteration. No Index/Where/When None. |
CurrentInput
&Control = CurrentInput()
Returns the Name of the Input/DataGridView (from @Layout) that currently has focus. For a DataGridView, it matches if the cursor lands anywhere in its rectangle (header, attention row, or any data row), not just an exact cell. Only valid inside an Event’s body — using it anywhere else is an error.