23.11.2012 Views

2 Visual Components Manuals

2 Visual Components Manuals

2 Visual Components Manuals

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

Important:<br />

Text groups must be on the target if they are to be read. The pcTextlength variable has to transfer a string<br />

length. If the read length is smaller than the value input, then the actual length of the string is displayed.<br />

3.3.8.15.2 Example for Automation Basic<br />

(* cyclic program *)<br />

if ready = 0 then<br />

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

if VC_HANDLE 0 then<br />

ready = 1<br />

endif<br />

else<br />

Access_Status = VA_Saccess (1,VC_HANDLE)<br />

if Access_Status = 0 then<br />

pcTextlength = 70<br />

if (ReadingText = 1) then<br />

ReadingText = 0<br />

status = VA_GetTextByTextGroup(1,VC_HANDLE,TG_id,TGT_id,<br />

UDINT(ADR(pcText)),UDINT(ADR(pcTextlength)))<br />

endif<br />

endif<br />

endif<br />

VA_Srelease (1,VC_HANDLE)<br />

3.3.8.15.3 Example for C Programming<br />

#include <br />

#include <br />

#include <br />

unsigned long VC_HANDLE;<br />

_GLOBAL USINT ready;<br />

_GLOBAL USINT TG_id;<br />

_GLOBAL USINT TGT_id;<br />

_GLOBAL STRING pcText[80];<br />

_GLOBAL UDINT pcTextlength;<br />

_GLOBAL UINT status;<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 />

if (ready)<br />

{<br />

if (!VA_Saccess(1,VC_HANDLE))<br />

{<br />

status = VA_GetTextByTextGroup(1,VC_HANDLE,TG_id,TGT_id,(UDINT)pcText,(UDINT)&pcTextlength);<br />

VA_Srelease(1,VC_HANDLE);<br />

}<br />

}<br />

}<br />

3.3.8.16 User−Defined Touch Operation − VA_GetTouchAction<br />

The VA_GetTouchAction function can be used to retrieve the location of the current touch position, as well as<br />

the touch status (pressed/released).<br />

3.3.8.16.1 Parameter<br />

I/O Parameter Type Meaning<br />

IN enable BOOL This function is only executed if enable is TRUE.<br />

IN VCHandle UDINT The handle returned by VA_Setup.<br />

IN type UDINT Retrieval type.<br />

0 ... Processed<br />

1 ... REALTIME<br />

3.3.8.15 Graphics and Text Output − VA_GetTextByTextGroup 151

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

Saved successfully!

Ooh no, something went wrong!