guiButtonClickEvent (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

NX-400

Firmware version:

1.00.00


This function retrieves a button click event from the event queue, which is triggered when the user presses and then releases a button.

This function must be called to clear event 1 from guiWaitEvent.

 

Input:

None.

 

Output:

button : SYSHANDLE

The handle to the button.

 

long_press : BOOL

True if the button was kept pressed for a while, false if it was released sooner.

 

Returns: INT

0

- Data is ready.

-1

- Interface is not open (see guiOpen).

-6

- Data is not ready

-11

- The GUI API is not supported.

 

Declaration:

FUNCTION guiButtonClickEvent : INT;
VAR_INPUT
  button     : ACCESS SYSHANDLE;
  long_press : ACCESS BOOL;
END_VAR;

 

 

Example:

...
FUNCTION ButtonHandler
VAR
  rc     : INT;
  handle : SYSHANDLE;
  tag    : DINT := 0;
  lp     : BOOL;
END_VAR;
  rc := guiButtonClickEvent(button := handle, long_press := lp);
  IF rc = 0 THEN
    guiGetTag(handle := handle, tag := tag);
    IF lp THEN
        DebugFmt(message:="Button with tag \4 was pressed", v4 := tag);
    ELSE
        DebugFmt(message:="Button with tag \4 was clicked", v4 := tag);
    END_IF;
  END_IF;
END_FUNCTION;
...