Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flex 4.6 hide/dismiss softkeyboard

I'm having some issues with the softkeyboard behaviour in flex 4.6 and air 3.1

I have a list with a search bar on top. When a user selects the TextInput component the softkeyboard pops up like it should. Now when the user is done typing his text and presses the return (or the done/search/...) key I want the softkeyboard to disappear.

What I've tried so far:

  • I've set the returnKeyLabel property to "done" and the button shows up accordingly. However it only dismisses the keyboard on Android, on IOS the keyboard just stays up.

  • I then tried by not setting the returnKeyLabel and manually catching the Return key and setting the focus to another element that does not require a softkeyboard but that didn't work either.

  • I also tried by dispatching my own "faked" click events when the Return key was pressed but this also didn't work.

As part of searching about this problem I found this Dismiss SoftKeyboard in Flex Mobile but that didn't work either. Or at least not in flex 4.6

Now does anyone know of a good way to hide the softkeyboard or make the returnKeyLabel "done" work on IOS that will work with flex 4.6/air 3.1?

like image 838
Beele Avatar asked Dec 15 '11 13:12

Beele


2 Answers

Have you tried something like this?

<s:TextInput prompt="First Name" returnKeyLabel="done" enter="handlerFunction()"/>  
private function handlerFunction():void{
    stage.focus = null
} 
like image 138
francis Avatar answered Oct 07 '22 21:10

francis


For flex mobile android apps I have mimicked the intuitive ios way of tapping on the background to remove the softkeyboard as follows:

import spark.components.supportClasses.*
        protected function application1_clickHandler(event:MouseEvent):void
        {

            if(event.target is StyleableTextField || event.target is StyleableStageText){
                // ignore because came from a textInput
            }else{
                stage.focus = null
                // to remove the softkeyboard
            }
        }
like image 25
Ged Avatar answered Oct 07 '22 20:10

Ged