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

Native Development

Reply
BlackBerry Development Advisor (Retired)
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: How to set keyboard layout?

Don't forget the Q_OBJECT too.  Look at any of the Cascades samples.   This enables Qt-isms like signals/slots and some Qt typing for your class.   The public slots: tells Qt to allow this to be connected in a slot.

Contributor
Posts: 45
Registered: ‎03-02-2012
My Device: Torch 9810
My Carrier: Vodafone

Re: How to set keyboard layout?

Yes, I already had it.

 

I noticed that I also have to call virtualkeyboard_show() if I closed it and click on a managed textbox.

Also I have problem with my Calculate function, maybe it is caused by its empty firm since the app crash if I try to type. 

 

I'll try later.

Thank you. 

Contributor
Posts: 45
Registered: ‎03-02-2012
My Device: Torch 9810
My Carrier: Vodafone

Re: How to set keyboard layout?

It's strange, but when I open the keyboard on console I read:

ERROR::  ApplicationEngine: popupKeyboard(1)

(Or 0 if closing)

 

The app keeps running, but it strange...

 

Also, if I change the keyboard to the standard layout and then I click on a TextField connected to our event, it doesn't change to NUM_PUNC.

 

A last question: there is a way to filter what the user can type? I've tried with the "onTextChanging" but I cannot deny the user to insert illegal characters, just check their existence then... accept that the user is naughty.

 

Thanks. 

BlackBerry Development Advisor (Retired)
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: How to set keyboard layout?

I added this to GoodCitizen, handleClick, in the handler for green (2nd one):

 

            static int  layout = -1;

            selected = 2;
            cube_color[0] = 0.0f;
            cube_color[1] = 1.0f;
            cube_color[2] = 0.0f;
            cube_color[3] = 1.0f;
            ++layout;
            if (layout > VIRTUALKEYBOARD_LAYOUT_PIN)
            {
                layout = -1;
                virtualkeyboard_hide();
            }
            else
            {
                virtualkeyboard_change_options(layout, VIRTUALKEYBOARD_ENTER_DEFAULT);
                if (layout == 0)
                    virtualkeyboard_show();
            }

 

This seems to cycle through the options for me.

Are you able to demonstrate part of your issue with this?

 

Stuart

BlackBerry Development Advisor (Retired)
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: How to set keyboard layout?

[ Edited ]

Sorry, was temporarily thinking Playbook.

 

I haven't investigated fully, but is it possible that you are trying to change focus from within a routine that is changing focus?  That typically causes odd behaviour in any UI framework.

 

Try only doing this on touch up.  If you are doing this on touch down or move (or cancel) then we might get odd behaviour.

 

Stuart

BlackBerry Development Advisor (Retired)
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: How to set keyboard layout?

I played with this a bit.

 

In cascadescookbook, intro.{cpp,h} I changed the keyboard option in a touch handler for the input field:

 

in intro.h:

namespace bb
{
    namespace cascades
    {
        class Container;
        class TouchEvent;
    }
}

...

public slots:
    void onExampleTouch(bb::cascades::TouchEvent*);


in intro.cpp:

#include <bps/virtualkeyboard.h>
...

Container* Intro::setUpExampleUI()

{

...

    connect(exampleTextArea, SIGNAL(touch(bb::cascades::TouchEvent*)), this, SLOT(onExampleTouch(bb::cascades::TouchEvent*)));
...


void Intro::smileysurprised:nExampleTouch(bb::cascades::TouchEvent* event)
{
    if (event == 0)
        return;

    if (event->isDown())
    {
        virtualkeyboard_change_options(VIRTUALKEYBOARD_LAYOUT_NUM_PUNC, VIRTUALKEYBOARD_ENTER_DEFAULT);
    }

}

 

Here's what I observe:

- doesn't matter if do this on up or down event, we get the right keyboard.

- if we then go to the Input page and click there we get the right keyboard for there

- If I restart and go directly to the Input page which I didn't touch, I get the ERROR: ApplicationEngine: popupKeyboard(1) which you reported.  So that seems to be a spurious message.

 

So...

1. I think the ERROR is spurious.  I'll follow up on this.

2. I don't quite understand what you mean by: "Also, if I change the keyboard to the standard layout and then I click on a TextField connected to our event, it doesn't change to NUM_PUNC."   Can you play with my adjustment to cascadescookbook to demostrate?

3. I don't see a way to define illegal characters for the keyboard.  I think you'll have to deal with that when you validate the input.   Did you discover anything?

 

Stuart

BlackBerry Development Advisor (Retired)
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: How to set keyboard layout?

Spurious error:

https://www.blackberry.com/jira/browse/BBTEN-46

 

Need property to set keyboard:

https://www.blackberry.com/jira/browse/BBTEN-47

 

Feel free to vote for 47 :smileyhappy:

 

Stuart

BlackBerry Development Advisor (Retired)
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: How to set keyboard layout?

Do you have additional questions?

If the Jira issues BBTEN-46 and BBTEN-47 capture everything, please like the issues and accept a solution to close the thread.

Otherwise, how else can we help?

 

Stuart

Contributor
Posts: 45
Registered: ‎03-02-2012
My Device: Torch 9810
My Carrier: Vodafone

Re: How to set keyboard layout?

I cannot see them...
Contributor
Posts: 45
Registered: ‎03-02-2012
My Device: Torch 9810
My Carrier: Vodafone

Re: How to set keyboard layout?

[ Edited ]

It isn't the same situation:

 

I have two textbox: A and B, both accept only numbers and are connected to a "TouchDown" event.

 

When the users touches A, I change the keyboard layout to NUM_PUNC.

Then the user changes the keyboard layout to DEFAULT* (this is something I don't want the user  to be able to do, but let's pass over this);

If the user touches B, the keyboard layout doesn't changes.

 

In order to change it, I have to touch every non-textinput element, like a button o just the background.

 

 

But I've resolved hiding and showing the keyboard before changing the layout.

 

void Intro::onExampleTouch(bb::cascades::TouchEvent* event)
{
    if (event == 0)
        return;

    if (event->isDown())
    {
    	virtualkeyboard_hide();
    	virtualkeyboard_show();
    	virtualkeyboard_change_options(VIRTUALKEYBOARD_LAYOUT_NUM_PUNC, VIRTUALKEYBOARD_ENTER_DEFAULT);
    }
}

 I've tried different combinations, like showing it after changing the input, or not calling the show method at all...

 

This is the only way. It just works. 

 

 

*maybe because he inserts text into a third textinput which accept normal text