This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Show control inline in PC/Tablet
#19
(27.01.2017, 15:33)Mirco Wrote: Erwin can you make an example? Because I don't know how to do that. Big Grin

Hi Mirco,

You can create a HTML file like this and put it in a iframe with this URL "/user/input.html", run this LUA code once to create the file:

Code:
-- use this path in your iframe: /user/input.html

dst = '/www/user/input.html'
io.writefile(dst, [[
<!DOCTYPE html">
<head>
 <script type="text/javascript" src="/scada/vis/jquery.js.gz"></script>
 <style type="text/css">
            body {
                background-color: transparent;
            }
         .stringinput{
             width: 240px;
            }
       .savebtn{
             width: 120px;
            }
 </style>
</head>
<body>
 <table width="100" border="0">
   <tr>
 <input id="value1" class="stringinput" type="text" maxlength="255" />
   </tr>
   <tr>
       <input id="btnsave1" class="savebtn" type="button"value="Save" />
   </tr>
 </table>
 <table width="100" border="0">
   <tr>
         <input id="value2" class="stringinput" type="text" maxlength="255" />
   </tr>
    <tr>
 <input id="btnsave2" class="savebtn" type="button"value="Save" />
   </tr>
 </table>
<script>
var p = window.parent;
var obj1dpt;
var obj2dpt;
if (p && p.objectStore){  
 addr1 = p.Scada.encodeGroupAddress('1/2/34');    
 p.objectStore.addListener(addr1, function(obj, type) {
   $("#value1").val(obj.value);
   obj1dpt = obj.rawdatatype;
 });

 addr2 = p.Scada.encodeGroupAddress('1/2/35');    
 p.objectStore.addListener(addr2, function(obj, type) {
   $("#value2").val(obj.value);
   obj2dpt = obj.rawdatatype;
 });

 $("#btnsave1").on("vclick",function(){
   var value1 = $('#value1').val();
   p.setObjectValue({ address: ('1/2/34') , rawdatatype: obj1dpt }, value1, 'text');
 });

 $("#btnsave2").on("vclick",function(){
   var value2 = $('#value2').val();
   p.setObjectValue({ address: ('1/2/35') , rawdatatype: obj2dpt }, value2, 'text');
 });
};
</script>
</body>
</html>
]])
script.disable(_SCRIPTNAME)

BR,

Erwin
Reply


Messages In This Thread
Show control inline in PC/Tablet - by Mirco - 26.01.2017, 06:51
RE: Show control inline in PC/Tablet - by Erwin van der Zwart - 28.01.2017, 12:43

Forum Jump: