The function block returns the ID of a clicked button from a dialog on an NMP.
Note that the ID is only valid after an "NMP Dialog Click" event is raised; the event will be removed when this function block is called.
Input:
None.
Output:
id : INT
The ID of the clicked button.
2
|
- OK.
|
3
|
- Cancel.
|
4
|
- Abort.
|
5
|
- Retry.
|
6
|
- Ignore.
|
7
|
- Yes.
|
8
|
- No.
|
ready : BOOL
TRUE:
|
If data is ready.
|
FALSE:
|
If data is not ready.
|
Declaration:
FUNCTION_BLOCK nmpDialogClickReceive;
VAR_OUTPUT
id : INT;
ready : BOOL;
END_VAR;
Example:
INCLUDE rtcu.inc
VAR
dialogClick : nmpDialogClickReceive;
END_VAR;
FUNCTION DialogClicked;
dialogClick();
IF dialogClick.ready THEN
DebugMsg(message := "*** Dialog Clicked ***");
DebugFmt(message := "-button=\1", v1 := dialogClick.id);
END_IF;
END_FUNCTION;
THREAD_BLOCK navMonitor;
VAR
event : INT := 0;
END_VAR;
WHILE event <> -1 DO
event := navWaitEvent(timeout := -1);
CASE event OF
...
12: DialogClicked();
...
END_CASE;
END_WHILE;
END_THREAD_BLOCK;
|