guiShowChoice (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

NX-400

Firmware version:

1.00.00


This function shows a dialog that contains a message and a number of choices.

The dialog closes either when the user selects OK or Cancel, or when it times out.

gui_dialog_choice

Input:

message : STRING

The message to show to the user

 

timeout : INT (-1, 0..3600) default -1

The number of seconds without activity before the dialog closes by itself. Use -1 for no timeout.

 

count : INT (1..8)

The number of choices to show.

 

choice1 : STRING

The first choice to show.

 

choice2 : STRING

The second choice to show.

 

choice3 : STRING

The third choice to show.

 

choice4 : STRING

The fourth choice to show.

 

choice5 : STRING

The fifth choice to show.

 

choice6 : STRING

The sixth choice to show.

 

choice7 : STRING

The seventh choice to show.

 

choice8 : STRING

The eighth choice to show.

 

Output:

choice : INT

The index of the chosen choice.

 

Returns: INT

2

- Cancel

1

- OK

0

- Timeout.

-1

- Interface is not open (see guiOpen).

-3

- Invalid count or timeout.

-8

- The text contains invalid characters.

-9

- A dialog is already being shown.

-11

- The GUI API is not supported.

 

Declaration:

FUNCTION guiShowChoice : INT;
VAR_INPUT
  message : STRING;
  timeout : INT := -1;
  count   : INT;
  choice1 : STRING;
  choice2 : STRING;
  choice3 : STRING;
  choice4 : STRING;
  choice5 : STRING;
  choice6 : STRING;
  choice7 : STRING;
  choice8 : STRING;
  choice  : ACCESS INT;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  rc     : INT;
  choice : INT;
END_VAR;
 
BEGIN
  ...
  // Show a dialog to select a speed
  rc := guiShowChoice(message := "Select the speed", timeout:=10, count := 3,
     choice1 := "Slow", choice2 := "Medium", choice3 := "Fast", choice := choice);
  ...
END;
END_PROGRAM;