This method waits for the next dialog event, returning a string with the event identifier. For a dialog event, you can use user-defined triggers (added with the addTrigger() method), or ones from the control block of a static dialog, such as a DISPLAY ARRAY.
At encountering a dialog error or termination, the method returns NULL. Note that it returns a basic description only. For a detailed one, use the getEventDescription() method.
To add a dynamic dialog, this method should be used in a WHILE loop.
nextEvent()
RETURNS STRING
MAIN
DEFINE d ui.Dialog
DEFINE t STRING
DEFINE fields DYNAMIC ARRAY OF RECORD
name STRING,
type STRING
END RECORD
OPEN WINDOW w WITH FORM "datetimeedit" ATTRIBUTE(BORDER)
LET fields[1].name="f1"
LET fields[1].type="DATETIME YEAR TO SECOND"
LET d = ui.Dialog.createInputByName(fields)
CALL d.addTrigger("ON ACTION exit")
CALL d.addTrigger("ON ACTION show f1")
WHILE (t := d.nextEvent()) IS NOT NULL
CASE t
WHEN "ON ACTION show f1"
DISPLAY d.getFieldValue("f1") TO info
WHEN "ON ACTION exit"
EXIT WHILE
END CASE
END WHILE
CALL d.Close()
LET d = NULL
END MAIN
A form file:
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://namespaces.querix.com/2015/fglForms">
<form.rootContainer>
<GridPanel fieldTable="" identifier="grid1">
<GridPanel.gridRowDefinitions>
<GridRowDefinition/>
<GridRowDefinition gridLengthValue=""/>
</GridPanel.gridRowDefinitions>
<GridPanel.gridColumnDefinitions>
<GridColumnDefinition/>
</GridPanel.gridColumnDefinitions>
<DateTimeEditField dataType="Char,,,," preferredSize="28qch,1qch" gridItemLocation="0,0,1,1" fieldTable="formonly" identifier="f1"/>
<Label text="New Label" isDynamic="true" visible="true" identifier="info" gridItemLocation="0,1,1,1"/>
</GridPanel>
</form.rootContainer>
</form>
To add a user-defined trigger to the dialog, use the addTrigger() method.
The list of possible user-defined triggers is the following:
| Trigger Name | Usage | Analog |
| ON ACTION <action_name> | Action as a trigger | ON ACTION clause |
| ON APPEND | Row appending in a DISPLAY ARRAY dynamic dialog | ON APPEND clause |
| ON DELETE | Row deletion in a DISPLAY ARRAY dynamic dialog | ON DELETE clause |
| ON FILL BUFFER | Paged mode in a DISPLAY ARRAY dynamic dialog | ON FILL BUFFER clause |
| ON INSERT | Row insertion in a DISPLAY ARRAY dynamic dialog | ON INSERT clause |
| ON IDLE | Idle timeout trigger | ON IDLE clause |
| ON SORT | Sorting event | ON SORT clause |
| ON TIMER | Timer trigger | ON TIMER clause |
| ON UPDATE | Row update in a DISPLAY ARRAY dynamic dialog | ON UPDATE clause |
The list of possible predefined triggers is the following:
| Trigger Name | Usage | Analog |
| BEFORE DIALOG | Acts as a trigger at initialization of a dynamic dialog. | BEFORE DIALOG |
| AFTER DIALOG | Acts as a trigger at initialization of a multiple dynamic dialog. | AFTER DIALOG |
| BEFORE DISPLAY | In a single dynamic dialog, serves as a trigger at a dialog initialization. In a multiple dynamic dialog, acts as a trigger when the dialog receives focus. | BEFORE DISPLAY |
| AFTER DISPLAY | In a single dynamic dialog, serves as a trigger at a dialog termination. In a multiple dynamic dialog, acts as a trigger when the display array no longer has focus. | AFTER DISPLAY |
| BEFORE INPUT | In a single dynamic dialog, serves as a trigger at a dialog initialization. In multiple dynamic dialog, acts as a trigger when the input by name receives focus. | BEFORE INPUT |
| AFTER INPUT | In a single dynamic dialog, serves as a trigger after the input by name ends. In multiple dynamic dialog, acts as a trigger when the input by name no longer has focus. | AFTER INPUT |
| BEFORE CONSTRUCT | In a single dialog, serves as a trigger at the construct initialization. In multiple dynamic dialog, acts as a trigger when the construct receives focus. | BEFORE CONSTRUCT |
| AFTER CONSTRUCT | In a single dynamic dialog, serves as a trigger after the construct ends. In multiple dynamic dialog, acts as a trigger when the construct no longer has focus. | AFTER CONSTRUCT |
| BEFORE ROW | Serves as a trigger at moving to the row in an INPUT ARRAY or a DISPLAY ARRAY dialog. | BEFORE ROW |
| AFTER ROW | Serves as a trigger at leaving the row in an INPUT ARRAY or a DISPLAY ARRAY dialog. | AFTER ROW |
| BEFORE INSERT | The event is triggered with a new row creation. | BEFORE INSERT |
| AFTER INSERT | The event is triggered after a new row creation. | AFTER INSERT |
| BEFORE DELETE | The event is triggered with a row deletion. | BEFORE DELETE |
| AFTER DELETE | The event is triggered after a row deletion. | AFTER DELETE |
| BEFORE FIELD | The event is triggered with entering the field in an INPUT dynamic dialog. | BEFORE FIELD |
| AFTER FIELD | The event is triggered with leaving the field in an INPUT dynamic dialog. | AFTER FIELD |
| ON CHANGE | The event is triggered on a field change. | ON CHANGE |