8 Replies Latest reply on Dec 18, 2012 6:35 AM by Devendra Tewari

    Back softkey

      Hi all,

       

      Our application has 3 screens: splash screen, main screen and a survey screen. But it is One Single Page application, i.e. those screens are in DIVs.

       

      When we press the back softkey of the android tablet we would like to be able to change from one view to another. However we can't handle the press event when it's fired.

       

      In Ruby the command "render" says where to go when pressing Back. For instance: render :back => '/app'. Instead of setting the address (/app), we have tried to set a function that should be called when Back softkey was pressed, for example: render :back => url_for(:action => :goBack), where goBack (code below) would call a javascript function called changePage(). This function is responsible for hiding one view and show another.

       

      def goBack

        WebView.execute_js("

      changePage();")

      end

       

      However when we hide one DIV and show another the screen gets black. It's like it's not being loading any page.

        • Re: Back softkey

          Hello Devendra,

           

          I feel the same can be achieved through the KeyCapture module of Rholements.

          you can use the KeyEvent after pressing the backsoft key and can call the required javascript function in call back.

           

          for more deatils Please go through the below link

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

           

          Thank You.

          Patro

          1 of 1 people found this helpful
            • Re: Back softkey

              Hi Patro.

               

              I used this code below:

               

              <META HTTP-Equiv="KeyCapture" content="TriggerEvent:url('test')">

               

              in my layout.erb, inside <meta> tag. I also created a function test with an alert('test');

               

              Nothing happened with I pressed back softkey.

                • Re: Back softkey

                  you can use the below example in erb file

                  <META HTTP-Equiv="KeyCapture" Content="KeyValue:0x0D; Dispatch:False; KeyEvent:url('JavaScript:alert('Return Key Pressed');')">

                   

                  or Ruby object of KeyCapture is also available which can be mentioned inside controller

                   

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

                   

                  and to use KeyCaptrure Object we need to mention app_type as rholelements in build.yml before building the application.

                   

                  Please find the attached test page of keycapture module in ruby for reference.

                   

                  Thanks

                   

                  Patro

                    • Re: Back softkey
                      Benedict Kennedy

                      I am making the presumption that you are using the Motorola ET1 Android Tablet. If so, the back key is KeyValue 0xA6. If you wish to capture this key the META tag will need to be:

                       

                      <meta HTTP-Equiv="KeyCapture" Content="KeyValue:0xA6; Dispatch:False; KeyEvent:url('JavaScript:alert('Back Key Pressed');')">
                      

                       

                      Alternatively, if you are using a different tablet, you can find out what the key value is by using this Code:

                       

                      <meta HTTP-Equiv="KeyCapture" Content="KeyValue:All; Dispatch:False; KeyEvent:url('JavaScript:alert('Key Pressed: %1');')" />
                      

                       

                      Please note, the values will be returned in Decimal and the KeyValue field understands Hexidecimal.

                       

                      Best regards,

                      Ben

                      • Re: Back softkey

                        The thing is when I use app_type:rhoelements in build.yml, the Product Registration popup appeared in the screen and then I updated it with the key that I have.

                        From that day on the Product Registration popup remains on the screen over my application. It says:

                         

                        Product Registration

                         

                        <Moto logo>               RHOELEMENTS               2

                         

                        Version

                         

                        <blank space>

                          

                        (c) Copyright 2011 Motorola Solutions, Inc. All rights reserved.

                         

                         

                        I noticed that my application answers to my touchs, mas I see nothing of it because the popup remains on focus.

                         

                        PS: I didn't have access to a ET1 tablet, so I'm using XOOM for it.

                          • Re: Back softkey
                            Benedict Kennedy

                            Hi Devendra,

                             

                            Just to confirm, are you saying that this Licensing Pop-Up remains on your screen for the life of the application (i.e. it wont disappear)? If so, this is definitely a bug.

                             

                            May I ask which version of RhoElements you are using? And is this the original XOOM?

                             

                            Best regards,

                            Ben

                              • Re: Back softkey

                                Hi Ben,

                                 

                                Thank you for you reply.

                                 

                                I'm using RhoStudio 2.0.0.201208081702. Rhodes 3.4.2

                                I downloaded RMS_2.2.1.12.exe these days, but didn't install it yet.

                                Yes, it's the original XOOM.

                                 

                                Thanks.

                                  • Re: Back softkey

                                    Hi all,

                                     

                                    I installed RMS_2.2.1.12.exe and used app_type: "rhoelements" in build.yml. The Product Registration popup appeared but only with the text "Please, provide correct RhoElements license" and a button labeled OK. When I click OK the popup is dismissed and I can use my application.

                                     

                                    Besides, the KeyCapture module of Rholements worked out.

                                     

                                    Thank you very much.