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

Web and WebWorks Development

Reply
Contributor
Posts: 12
Registered: ‎01-15-2011
My Device: Not Specified

Bringing up keyboard programmatically

I am developing a word game for the tablet using the WebWorks SDK. I have a series of text-boxes for each letter of the word. As the user types in a letter in one text box I immediately shift focus to the next text box.

 

When I run it in the simulator, the focus does shift to the next text-box but the keyboard disappears. The user has to explicitly click the text-box for the keyboard to appear. This is of course very annoying for the user as it messes up the flow of typing the word.

 

Is there a way that I can programmatically bring up the keyboard? And better still, is there a way that I can always keep the keyboard up and programmatically hide it once the user is done typing the letters?

 

Thanks,

Keyur

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Bringing up keyboard programmatically

Hi Keyur,

 

Right now this functionality isn't exposed in the WebWorks JavaScript API.  Are you familiar with writing Java code?  If so you could create a JavaScript extension that would allow you to show/hide the keyboard and use it in your WebWorks application.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 12
Registered: ‎01-15-2011
My Device: Not Specified

Re: Bringing up keyboard programmatically

Thanks, Jim.

 

Did you mean writing JavaScript extensions in Java? Well, Java is my bread and butter so that's probably a good thing for me :-) Can you point me to some docs that talk about writing extensions?

 

== Keyur

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Bringing up keyboard programmatically

Contributor
Posts: 12
Registered: ‎01-15-2011
My Device: Not Specified

Re: Bringing up keyboard programmatically

Thanks, Tim. I'll need to spend some time on this. Will probably bug you again if I have questions.

 

Also, if there are docs that explicitly talk about keyboard manipulations that'll be great.

Contributor
Posts: 12
Registered: ‎01-15-2011
My Device: Not Specified

Re: Bringing up keyboard programmatically

Hi Tim - Went through tutorials and docs and I think I understand the extension pattern now. But for my case I have a very basic question - I need access to the VirtualKeyboard instance. I can get that instance by invoking Screen.getVirtualKeyboard(). However, I am unclear on how I can get access to the Screen object from within my ScriptableFunction?

 

Thanks,

Keyur

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Bringing up keyboard programmatically

In the WidgetExtension interface you will find the following method

 

 

 public void register(WidgetConfig arg0, BrowserField arg1) {
   // TODO Auto-generated method stub
   }

 

 

You will see that it passes in an instance of BrowserField which derives from Field.  You can then call "getScreen()" on the BrowserField object.

 

You can pass this instance of Screen into your Extension as part of the constructor or as a setter.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 12
Registered: ‎01-15-2011
My Device: Not Specified

Re: Bringing up keyboard programmatically

[ Edited ]

Thanks again, Tim. I have the code written now but have run into the next wall - actually running it in the Playbook emulator. I think I am following the correct steps for packaging it up using the BB Packager but when I run it in the emulator, it does not seem to invoke the extension. I have even tried deploying the sample MyExtensionTest application but its extension does not seem to get invoked.

 

Am I doing something wrong? I can send you the generated BAR file if it helps.

 

== Keyur

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Bringing up keyboard programmatically

Ahhhhrrrrgggg.. I didn't see that you were writing for the Tablet, I should have read your first post more carefully... Sorry but it appears I lead you down the wrong road.

 

The way that I have described for extending a WebWorks application using Java is for the BlackBerry Smartphone only and not the Tablet OS.

 

Again my appologies!! 

 

We have not yet documented how to extend the PlayBook WebWorks environment with your own custom extensions.  On the PlayBook you will have to extend using ActionScript/AIR to access the system level functionality that is not exposed by WebWorks.

 

You will have to stay tuned for tutorials on how to do this same thing on PlayBook.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 27
Registered: ‎01-20-2011
My Device: Bold
My Carrier: Developer

Re: Bringing up keyboard programmatically

hi tim, can i use this javascript extention to call an SOAP web service using KSOAP?

can call the function from webwork application?

---------------------------------------------------------------
Best Regards

William