3 Replies Latest reply on Oct 13, 2017 7:39 AM by ABHINEET AGARWAL

    MK3100 two button press in Enterprise Browser

    Michael Viox

      Hi!

      OK so I have written this JScript (which doesn't work), but I am trying to capture the event of 2 buttons [UpArrow] && [escape] to be able to quite the app.

       

      <Javascript>

      var KEY_SOFT1 = EB.KeyCapture.captureKey(true, 0x28);

      var KEY_SOFT2 = EB.KeyCapture.captureKey(true, 0x26);

      var KEY_SOFT3 = EB.KeyCapture.captureKey(true, 0x0D);

      var KEY_SOFT4 = EB.KeyCapture.captureKey(true, 0x1B);

      var map = {};

       

       

      function doQuit()

      {

              'use strict';

              var genObj = new ActiveXObject("PocketBrowser.Generic");

      genObj.InvokemetaFunction('application', 'quit');

      }

      function doKeys(map{}){

      onkeydown = onkeyup = function(e){

          e = e || event; // to deal with IE

          map[e.keyCode] = e.type == 'keydown';

          if(map{KEY_SOFT1} && map{KEY_SOFT4}){

              doQuit();

              map = {};

          }

      }

      }

       

      <HTML>

      <META HTTP-Equiv="KeyCapture" Content="KeyValue:0x26,KeyValue:0x1B; Dispatch:False; KeyEvent:url('Javascript:doKeys('%s','%s')');')"/>

       

       

      Any suggestions would be very helpful!

        • Re: MK3100 two button press in Enterprise Browser
          ABHINEET AGARWAL

          Dear Michael,

           

          Try this out. I am hoping that Enterprise Browser Webkit Cab is being used in th device.

          <html>

          <head>

          <META HTTP-Equiv="KeyCapture" Content="KeyValue:ALL;Dispatch:False;KeyEvent:url('JavaScript:jsKeyEvent('%s');')"/>

          <script type="text/javascript">

               //Callback function associated with key pressed events

               function jsKeyEvent(keyData)

              {

                 document.getElementById('myJsID').innerHTML = "Key Pressed:" + keyData;

                 if((keyData==38) ||(keyData==27))//38 is for Key Up & 27 is for ESC key

                {

                   application.quit();

                }

              }

          </script>

          </head>

          <body>   

            <br><input type='text'/><br>

            <div id='myJsID'>Key Pressed: </div>

          </body>

          </html>

           

          Let me know if you have any further queries.

           

          Thanks & Regards,

          Abhineet Agarwal

          Enterprise Browser Software Lead