ICP DAS USA ISaGRAF WinCE ViewPAC User Manual page 102

Table of Contents

Advertisement

5.4.3.1 Post Boolean Value to The Controller
A. To post by the image
...
function ON_OFF(form_obj, obj, current_boo_value)
{
if(current_boo_value==0)
{
flag = confirm("turn ON ?");
if(flag) obj.value=1;
}
else
{
flag = confirm("turn OFF ?");
if(flag) obj.value=0;
}
if(flag)
{
if(GetUserID(form_obj)==true) form_obj.submit();
}
}
function refresh_data()
{
B2.src = "img/cmd" + boolean_val*2+ + ".jpg" ;
}
...
<body onLoad="init()">
...
<div style="position: absolute; width:100px;height:100px; z-index: 5; left: 242px; top: 164px" >
"cursor:hand" will display the mouse arrow as a hand when entering the image area
<img style="cursor:hand" name="B2" onclick="ON_OFF(form_B2, form_B2.B2, boolean_val[2])"
src="img/cmd0.jpg">
Name of the
image object
Name of the
form
<form name="form_B2" method="post" action="./main.dll">
<input name="BEGIN" type="hidden">
<input
name="B2"
<input name="END"
</form>
</div>
...
</body>
5-14
ON_OFF function is used for posting Boolean value to the
controller by refer to the current Boolean value.
The 1
The 2
The last parameter is the current Boolean value.
Demo example: vphmi_02 and vphmi_05
Display the current Boolean image. In this example,
0: display "img/cmd0.jpg", 1:"img/cmd1.jpg"
The layout (or location) of the image object "B2" is defined here
by the "<div" and "</div>" tags.
The onclick will call ON_OFF( ) when the mouse click on it.
st
The 1
parameter is the name of the "form". Here is "form_B2"
nd
The 2
parameter is the "<input>" name inside the form. Here is "form_B2.B2"
The last is the current boolean value. Here is boolean_val[2]
type="hidden" value="0">
type="hidden">
Name of "<input>" inside the form. Here is "B2". Because it is
inside "form_B2", then we must use the name of "form_B2.B2"
to identify it.
ISaGRAF WinCE ViewPAC User Manual , V.1.6 , 1/2017 by ICP DAS
st
parameter is the name of the "form".
nd
parameter is the "<input>" name inside the form.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vp-25w7Vp-23w7Vp-4137Vp-25w6Vp-23w6Vp-4136

Table of Contents