2 Replies Latest reply on Jul 2, 2011 12:25 AM by rstanvir

    May be a BUG: softKeyboardInputAreaOfInterest Problem

    rstanvir

      i have a view with various options. many textinputs and buttons in the view. Suppose i have two textinput (A,B) one button (C), which are of my major interest. also some other things on the view.

       

      When user click/tap on the textinput(A) the softkeyboard pops up.

       

      The good part is:

      The softkeyboard automatically gets the bounds of the the displayobject (the textinput), and push the displayobject (textinput) on top on it.

       

      But, I wanted to make visible all the 3 items (A,B,C) on top of the softkeyboard when i will click on the textinput A

      Fortunately, i found there is a property with softKeyboardInputAreaOfInterest.

       

      but my bad (or is this a bug) i couldnt manage to solve my purpose.

       

      i have attached a sample code at the end.

       

      But the story doesnt end here and the misery goes on

      I tried many things: tried to listen these events of textinput A and B

      softKeyboardActivate, softKeyboardActivating, softKeyboardDeactivate.

       

      i found that softKeyboardActivate, softKeyboardActivating is working/calling my listeners rightly but softKeyboardDeactivate was not.

       

      then figured out another strange thing: softKeyboardDeactivate is only get called when the device get orientation changed(horizontally to vertically or vice-versa), also it appears that this calling does not check whether the softkeyboard is currently active or not . it just get call and call, you rotate the device it get called.

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
                xmlns:s="library://ns.adobe.com/flex/spark" actionBarVisible="false"
                tabBarVisible="false">
           <fx:Script>
                <![CDATA[               
                     protected function debug(str:String):void
                     {
                          txtUsername.text += str;
                     }               
                ]]>
           </fx:Script>
           <s:Scroller width="100%" height="100%">
                <s:VGroup left="10" right="10" top="10" bottom="10" gap="15" id="vGroup"
                            verticalAlign="middle" horizontalAlign="right">
                     <s:Button label="bla bla bla bla bla bla"/>
                     <s:Button label="bla bla bla bla bla bla"/>
                     <s:Button label="bla bla bla bla bla bla"/>
                     <s:Button label="bla bla bla bla bla bla"/>
                     <s:Button label="bla bla bla bla bla bla"/>
                     <s:Button label="bla bla bla bla bla bla"/>
                     <s:Button label="bla bla bla bla bla bla"/>
                     
      
                     <!-- Area of interest:- start  -->
                     
                     <s:TextInput width="100%" prompt="username" height="70"
                                     tabEnabled="true" id="txtUsername"
                                     needsSoftKeyboard="true" softKeyboardInputAreaOfInterest="{btnSignIn.getBounds(stage)}"
                                     softKeyboardActivate="{debug('ua:')}" softKeyboardActivating="{debug('ui:')}" 
                                     softKeyboardDeactivate="{debug('ud:')}"/>
                     
                     <s:TextInput width="100%" prompt="password" height="70"
                                     tabEnabled="true"
                                     displayAsPassword="true" id="txtPasswordField"
                                     needsSoftKeyboard="true" softKeyboardInputAreaOfInterest="{btnSignIn.getBounds(stage)}"
                                     softKeyboardActivate="{debug('pa:')}" softKeyboardActivating="{debug('pi:')}" 
                                     softKeyboardDeactivate="{debug('pd:')}"/>
                     <s:Button label="Sign In" id="btnSignIn"/>
                     
                     <!-- Area of interest:- end  -->
                     
                     <s:Spacer height="100%" />
                     <s:Button label="Exit application" click="{NativeApplication.nativeApplication.exit(0)}"/>
                </s:VGroup>          
           </s:Scroller>
      </s:View>
      
       
      

       

       

      Regards

      tanvir