23.11.2012 Views

2 Visual Components Manuals

2 Visual Components Manuals

2 Visual Components Manuals

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

REALTIME means that each touch action can be queried in real−time.<br />

Processed means that touch actions (i.e. with opened touch input) do not get<br />

through.<br />

IN status UDINT Address of a TouchAction structure. This will be described further down the page.<br />

OUT Return Value UINT Not equal to 0 if error occurs<br />

3.3.8.16.2 TouchAction structure<br />

Variable Meaning<br />

x The last pressed X position<br />

y The last pressed Y position<br />

status<br />

1 ... pressed<br />

2 ... released<br />

The TouchAction structure records the current touch status.<br />

3.3.8.16.3 Example for Automation Basic<br />

(* cyclic program *)<br />

if ready 1 then<br />

VC_HANDLE = VA_Setup(1 "vga") ,<br />

VC_HANDLE if 0 then<br />

ready = 1<br />

endif<br />

endif<br />

if ready = 1 then<br />

if VA_Saccess(1,VC_HANDLE)= 0 then<br />

endif<br />

VA_GetTouchAction (1,0, UDINT(adr(touch)))<br />

VC_HANDLE,<br />

x_position = touch.x<br />

y_position = touch.y<br />

touch_status = touch.status<br />

VA_Srelease(1,VC_HANDLE)<br />

endif<br />

3.3.8.16.4 Example for C Programming<br />

#include <br />

#include <br />

#include <br />

UINT _GLOBAL ready;<br />

TouchAction _GLOBAL touch;<br />

UDINT _GLOBAL x_position;<br />

UDINT _GLOBAL y_position;<br />

UDINT _GLOBAL touch_status;<br />

unsigned long VC_HANDLE;<br />

_CYCLIC void Cyclic(void)<br />

{<br />

if (!ready)<br />

{<br />

VC_HANDLE = VA_Setup(1 "vga"); ,<br />

if (VC_HANDLE)<br />

ready = 1;<br />

}<br />

Introduction to <strong>Visual</strong> <strong>Components</strong> 2.3<br />

152 3.3.8.16 User−Defined Touch Operation − VA_GetTouchAction

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!