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
Developer
level32
Posts: 52
Registered: ‎03-29-2012
My Device: Playbook, Dev Alpha

how do I show the software keyboard from qml?

I have a Sheet that has a TextField in it. When I show the Sheet, I want to show the keyboard. 

 

I was able to find the RequestSoftwareInputPanel event, but I have no idea how to dispatch it. 

 

Here's the code:

 

 

Sheet {
    //... some content

    onVisibleChanged: {
        if (visible) {
            // dispatch RequestSoftwareInputPanel
        }
    }
}

 

 

 

Developer
soaman
Posts: 849
Registered: ‎03-03-2011
My Device: Z10

Re: how do I show the software keyboard from qml?

One way is to develop your own class with method called popupKeyboard(), pass the object of that class as property context to QML and then call the method.
--------------------------------------------------------------------------------------
Leader of Ljubljana BlackBerry Developer Group
BlackBerry Certified Builder for Native Application Development
Developer
level32
Posts: 52
Registered: ‎03-29-2012
My Device: Playbook, Dev Alpha

Re: how do I show the software keyboard from qml?

I tried that using: 

 

QEvent event(QEvent::RequestSoftwareInputPanel);
QApplication::sendEvent(this, &event);

 Nothing happened.

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

Re: how do I show the software keyboard from qml?

In Beta1 I called:

 

        // Show the keyboard as number
        virtualkeyboard_hide();
        virtualkeyboard_show();
        virtualkeyboard_change_options(VIRTUALKEYBOARD_LAYOUT_NUM_PUNC, VIRTUALKEYBOARD_ENTER_DEFAULT);

 

I think this needs a tweak to work properly in Beta2 though.

 

https://developer.blackberry.com/native/beta/reference/com.qnx.doc.bps.lib_ref/com.qnx.doc.bps.lib_r...

 

Stuart

Developer
level32
Posts: 52
Registered: ‎03-29-2012
My Device: Playbook, Dev Alpha

Re: how do I show the software keyboard from qml?

That works...  So no qml call?

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

Re: how do I show the software keyboard from qml?

Not currently (unless I missed it).  TextInput has modes now, but there are issues logged against it; these fields of course pop up the keyboard, though you may find the behaviour better on the test device than on the simulator.  I assume you want to pop up the keyboard in other cases.  Currently you need to involve C++, AFAIK.

 

Stuart