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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Adobe AIR Development

Reply
Contributor
soul2k
Posts: 26
Registered: ‎05-08-2011
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.
Regular Contributor
Paratheo
Posts: 91
Registered: ‎04-25-2009
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: 26
Registered: ‎05-08-2011
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,149
Registered: ‎10-27-2010
My Carrier: AT&T

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,149
Registered: ‎10-27-2010
My Carrier: AT&T

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: 26
Registered: ‎05-08-2011
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,149
Registered: ‎10-27-2010
My Carrier: AT&T

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: 26
Registered: ‎05-08-2011
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.
Trusted Contributor
mdd
Posts: 197
Registered: ‎01-17-2012
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
dmalik
Posts: 339
Registered: ‎02-22-2012
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.