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.

3.3.8.20.3 Example for C Programming<br />

#include <br />

#include <br />

#include <br />

UINT _GLOBAL ready;<br />

unsigned long VC_HANDLE;<br />

UINT _GLOBAL x1;<br />

UINT _GLOBAL x2;<br />

UINT _GLOBAL y1;<br />

UINT _GLOBAL y2;<br />

UINT _GLOBAL fill;<br />

UINT _GLOBAL color;<br />

_CYCLIC void Cyclic(void)<br />

{<br />

x1 = 150;<br />

y1 = 100;<br />

x2 = 100;<br />

y2 = 150;<br />

fill = /* 255; Transparent */<br />

color /* = 0; Black */<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 />

VA_Rect (1,VC_HANDLE,x1,y1,x2,y2,fill,color);<br />

VA_Srelease(1,VC_HANDLE);<br />

}<br />

}<br />

}<br />

3.3.8.21 Graphics and Text Output − VA_Redraw<br />

The VA_Redraw function clears all VISAPI output and<br />

then redraws the picture.<br />

3.3.8.21.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 />

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

Warning:<br />

This function works asynchronously. This means that in some circumstances, subsequent Visapi functions (i.e.<br />

VA_Rect, etc.) are not drawn.<br />

In this case, the subsequent functions have already been executed before the VA_Redraw function is finished.<br />

If the VA_Redraw function now finishes (afterward), then all drawing functions which had been carried out after<br />

this function was called are erased.<br />

3.3.8.21.2 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 />

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

156 3.3.8.20 Graphics and Text Output − VA_Rect

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

Saved successfully!

Ooh no, something went wrong!