2 Replies Latest reply on Dec 7, 2012 2:42 AM by Benedict Kennedy

    ET1 P1 - P3 User buttons configurable in Rho?

      I found in the Rho config.xml file an option to configure P1-P3 user buttons.

       

      Is it possible to map them to perform other things like bring up a website?

       

      I suggested to my customer they may not want to change the volume buttons P1 and P2, otherwise users would have no ability to control the volume on the device.

       

                      <Device Keys>

                                      <EnableFunctionKey_F1     value="0"/>

                                      <EnableFunctionKey_F2     value="0"/>

                                      <EnableFunctionKey_F3     value="0"/>

                      </Device Keys>

       

      If this is possible, is this a Global Android Change?

        • Re: ET1 P1 - P3 User buttons configurable in Rho?
          Darryn Campbell

          Hi,

           

          RhoElements does not offer the ability to remap the P keys to other functions on the device.  I'm unsure if it's possible using the ET1 its self, regardless of Rho.

           

          Regards,

            • Re: ET1 P1 - P3 User buttons configurable in Rho?
              Benedict Kennedy

              You can use P1-P3 to go to a webpage within RhoElements. To do this change the value in the Config file:

               

              <Device Keys>
                   <EnableFunctionKey_F1     value="0"/>
                   <EnableFunctionKey_F2     value="0"/>
                   <EnableFunctionKey_F3     value="1"/>
              </Device Keys>
              

               

              And then in each page, listen to the KeyCapture event:

               

              function onLoad() {
                        keyCapture.keyValue = '0xAA' //P3
                        keyCapture.keyEvent = 'onKey(%json)';
              }
              window.addEventListener('load', onLoad);
              
              function onKey(jsonObj){
                        window.location = 'http://www.w3.org';
              }
              

               

              You will need to include this code in each page which the user can get to within your RhoElements app. One way would be to put this into a script (.js) file and import into each html file in your app.

               

              Another way to do it, if you want to listen to multiple buttons is to capture all buttons and do what you wish in the keyCapture event:

              function onLoad() {
                        keyCapture.keyValue = 'All' //P3
                        keyCapture.keyEvent = 'onKey(%json)';
              }
              window.addEventListener('load', onLoad);
              
              function onKey(jsonObj){
                        if(jsonObj.keyValue == '170') {
                                 //P3
                                  window.location = 'http://www.w3.org';
                        }
                        else if(jsonObj.keyValue == '166') {
                                  //Back Key
                                  goBack();
                        }
              }
              

               

              You can find more information on the keyCapture module help page:

              http://edgedocs.rhomobile.com/rhoelements/keycapture

               

              Regards,

              Ben

              1 of 1 people found this helpful