0 Replies Latest reply on Jul 19, 2013 4:44 PM by Hector Meza

    Shared Runtime Function Key trapping on MC91xx

    Hector Meza

      I wanted to share a sample of setting up function key capture with the Rho Shared runtime with an MC9190.


      Applications that want to trap function keys can do so with JavaScript and the Config.xml .  The following is a sample that tries to show this.  This sample originated as a result of a customer that had SAP with templates that were written for an older version of Pocket Browser and once they carried to code over, they found that the hex values were different and the application did not work.  This sample was create to demonstrate the trapping of the correct key values.

      Disclaimer: Code syntax is written for simplicity and ease of understanding.


      The application has a JS function that is looking for a 1-9 value to id the Fkey hit, it will then perform an action based on the

      Sample files are included

      1. Config.xml – enabled KeyCapture and all Fkeys (attached).






      Test with Results:







      Note: The JS is just simply displaying the KeyCapture results




        <script language="JavaScript">

              function setFKey(keyval){               




         Note: HTML code is also basic (examples 1-4 with results – numbers are for reference)





      F1)   <META HTTP-Equiv="KeyCapture" Content="keyValue:0x70; Dispatch:False; KeyEvent:url('JavaScript:setFKey('F1 val %s');')">  

      F2)   <META HTTP-Equiv="KeyCapture" Content="KeyValue:0x71; Dispatch:False; KeyEvent:url('JavaScript:alert('key presssed: %s');')">

      F3)   <META HTTP-Equiv="KeyCapture" Content="keyValue:0x72; Dispatch:False; KeyEvent:url('JavaScript:setFKey('3');')">  

      F4)   <META HTTP-Equiv="KeyCapture" Content="keyValue:0x73; Dispatch:False; KeyEvent:url('JavaScript:alert('4’);')"> 

      F5)   <META HTTP-Equiv="KeyCapture" Content="keyValue:0x73; Dispatch:False; KeyEvent:url('JavaScript:setFkey('%s’);')"> 

      F6)   <META HTTP-Equiv="KeyCapture" Content="keyValue:0x73; Dispatch:False; KeyEvent:url('JavaScript:alert('%s’);')"> 



      Pressing the fkey will result in the following:


        F1 will call the setFKey JS and displays “F1 val 112”

        F2 will call the alert JS and displays “key pressed: 113”

        F3 no call appears to be made to JS setFKey – nothing displays or no sound etc.

        F4 no call appears to be made to JS alert– nothing displays or no sound etc.

      F5 will call SetFKey JS and displays “116”

      F6 will call Alert JS and displays “117”



      The JS only seems to be called if you include %s (or %JSON).  The documentation has several samples – some showing the parameter %s and one showing ‘user text’. 


      The documentation references that a parameter is returned but not clear on what they can be – it states that they can have a number of parameters.



      Work around: Created a JS function that accepts the parameter and strips it to the desired value then call the SAP JS function.



      Attached is the sample that got me passed the issue (PS also changed to scroll up/down to page up/down as SAP needed that option).






      <script language="JavaScript">

              function stripFKey(keyval){

                  var fk = (keyval * 1) - 111;



               function setFKey(keyval2){

                  alert('setFKey value= ' + keyval2);






            <META HTTP-Equiv="KeyCapture" Content="keyValue:0x70; Dispatch:False; KeyEvent:url('JavaScript:stripFKey('%s');')">  <!--112 -->

            <META HTTP-Equiv="KeyCapture" Content="KeyValue:0x71; Dispatch:False; KeyEvent:url('JavaScript:stripFKey('%s');')"> <!--113 -->




      Hope you do not need this, but it is good information to have.