Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Contributor
soul2k
Posts: 29
Registered: ‎05-08-2011
My Device: Bold 9900 / Playbook
My Carrier: Rogers

Hide Virtual Keyboard in SDK 3.0

In the 2.0 SDK, we were able to hide the virtual keyboard after clicking on a standard TextField by using

 

this.stage.focus = null;

 This does not seem to be working in 3.0.  Does any one know a new way to achieve this ?

 

Please use plain text.
Developer
Paratheo
Posts: 125
Registered: ‎04-25-2009
My Device: Bold 9900
My Carrier: AT&T

Re: Hide Virtual Keyboard in SDK 3.0

This is still working for me...

 

stage.focus = null;

Please use plain text.
Contributor
soul2k
Posts: 29
Registered: ‎05-08-2011
My Device: Bold 9900 / Playbook
My Carrier: Rogers

Re: Hide Virtual Keyboard in SDK 3.0

[ Edited ]

This is the code I have running on the Dev Alpha OS 10.0.9.338

NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN,handleKeyDown);

...

private function handleKeyDown(e:KeyboardEvent):void
{
	if (e.keyCode == Keyboard.ENTER)
	{
		this.stage.focus = null;
	}
}

 

Could I be doing something wrong ?

Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Hide Virtual Keyboard in SDK 3.0

What if you add the same event listener to the stage (after the item has been added to the stage)?
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Hide Virtual Keyboard in SDK 3.0

Also, did you confirm (via a trace statement) that the function is even being called?
Please use plain text.
Contributor
soul2k
Posts: 29
Registered: ‎05-08-2011
My Device: Bold 9900 / Playbook
My Carrier: Rogers

Re: Hide Virtual Keyboard in SDK 3.0

[ Edited ]

I have confirmed that the code is being executed with trace statements surrounding the stage.focus = null code inside of the if statement.

 

Adding the listener to the stage produces the same result as nativeApplication.

The identical code resulted in hiding the keyboard on Dev Alpha OS 10.0.6 and PlayBook OS 2.0/2.1

 

Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Hide Virtual Keyboard in SDK 3.0

Seems like you have exhausted everything. I would create a simple app to showcase this bug and submit it to RIM as an issue.
Please use plain text.
Contributor
soul2k
Posts: 29
Registered: ‎05-08-2011
My Device: Bold 9900 / Playbook
My Carrier: Rogers

Re: Hide Virtual Keyboard in SDK 3.0

My best guess is that the stage.focus = null does not work anymore because the bb10 keyboard is now native and not in AIR anymore, meaning the focus does not even change when the keyboard appears.

 

Might be out of luck here until additions are made to the VirtualKeyboard API :smileysad:

Please use plain text.
Developer
Developer
mdd
Posts: 222
Registered: ‎01-17-2012
My Device: PB
My Carrier: ATT

Re: Hide Virtual Keyboard in SDK 3.0

I have the opposite problem: on simulator, soft keyboard not showing in dialogs, even though needSoftKeyboard = true.

 

Is this a known simulator limitation?

Please use plain text.
BlackBerry Development Advisor (Retired)
dmalik
Posts: 427
Registered: ‎02-22-2012
My Device: BlackBerry Z10, BlackBerry Dev Alpha C, BlackBerry PlayBook
My Carrier: Bell

Re: Hide Virtual Keyboard in SDK 3.0

This works for me:

addEventListener(FocusEvent.FOCUS_IN, focusInHandler, false, 0, true);

private function focusInHandler(event:FocusEvent):void
{
stage.focus = null;
}

 

 

Follow me on Twitter: @dustinmalik
-----------------------------------------------------------------------------------------------------
Keep up to date on BlackBerry development: http://devblog.blackberry.com/
Please use plain text.