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

Web and WebWorks Development

Regular Visitor
Posts: 1
Registered: ‎12-30-2010
My Device: Not Specified

Webworks - Javascript Extension to show/hide Virtual Keyboard

[ Edited ]

1. The BlackBerry handheld software version and BlackBerry model you are testing with (or simulating). 9800, 9700,


2. Webworks Apps


I have a input field, when it is few and user hits enter, it will update some data on the page. 

My problem is, after the Enter button is pressed, the keyboard do not go away, and it blocks half the screen. So I am looking for a way to hide the keyboard after user hits enter ( or press the image button, which does that automacticcally).


The method I come up is, detect user's "enter" keydown by JS, then call a Javascript Entension to hide the Keyboard. 

so I have successfully called the JSE, checked VirtualKeyboard.isSupported() and Touchscreen.isSupported() are true. then call a function. 

The function suppose to Hide the keyboard, which sounds easy. Here my problem comes , I tried several way to hide the screen's virtual keyboard, but it doesn't work and returns and error ( I put an alert("endJS") after the JSE call).


My code are as below:


public Object invoke(Object obj, Object[] args) throws Exception
 VirtualKeyboard keyboard;
 Screen _screen = UiApplication.getUiApplication().getActiveScreen(); // test 1
 //Screen _screen = browserField.getScreen(); //test 2
 keyboard = _screen.getVirtualKeyboard();


I tried test 1 and test 2, both could not get what I wanted.... so I am looking some expert's help here and hopefully I would get some. please let me know if the method should not be like this, or any other method is there. Thx in advance.