• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

AIR - prevent soft keyboard closing?

Explorer ,
Feb 12, 2012 Feb 12, 2012

Copy link to clipboard

Copied

Hello

I have a mobile AIR app with a simple layout:

<s:View ...>

<s:layout><s:VerticalLayout /></s:layout>

<s:TextArea width="100%" height="100%" />

<HGroup width="100%" >

     <s:Button label="button" />

     <s:Button label="button" />

     <s:Button label="button" />

</HGroup>

</s:View>

The application is set to resize when the soft keyboard opens by setting resizeForSoftKeyboard="true" in the main app. The textArea uses the default Flex 4.6 skin.

My problem is, that if the user opens the keyboard by typing text into my texArea, he will be unable to click the buttons below the TextArea, because as soon as he tries to click a button the soft keyboard lowers (because the focus it out of the TextArea) and immediately opens again (because the mouseDown position is now above the TextArea).

I think this is the order of events: 1. textArea loses focus 2. keyboard goes goes down, keyboardDeactivate event dispatched. 3. mouseDown registers on the (expanded) textArea, so keyboard comes back up.

How can i prevent the soft keyboard from closing, so the user is able to click the buttons between the TextArea and the keyboard?

Note: SkinnablePopupContainer uses some hack to solve this, i just cant figure out how..

Thanks

TOPICS
Development

Views

1.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 14, 2012 Feb 14, 2012

Copy link to clipboard

Copied

I'm looking for more or less the same answer.

what I want is a way to prevent the softkeyboard from going down after hitting enter.

I currently have a work around by calling a function that set's focus to a text field with a delay of 0.05 seconds after the return key on the softkeyboard has been pressed.

the function that is called with after the delay:

stage.focus = tf;

tf.requestSoftKeyboard();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 15, 2012 Feb 15, 2012

Copy link to clipboard

Copied

The problem with requestSoftKeyboard(); is, that it only works on Android...

What i did was the following:

i overlay an invisible Textfield over the button - this will cause the click event to register (and the keyboard goes down), but the layout does not register this change, thus youll left with an empty space where the keyboard was..

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 26, 2012 Mar 26, 2012

Copy link to clipboard

Copied

LATEST

The solution is to use: FocusEvent.MOUSE_FOCUS_CHANGE and when the target of the event is not TextField of input type you should event.preventDefault().

works like charm, if you want to hide it manually do "stage.focus  = null"

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines