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
Posts: 68
Registered: ‎11-12-2013
My Device: Z10
My Carrier: Rogers
Accepted Solution

Cursor (caret) not displaying in text area after insert of text or position change

I have managed to change the cursor position in a TextArea in both qml and C++ using through the editor associated with the drop down.

 

I verified the change by getting cursor, changing position and getting position again.

 

However, the cursor does not display or is not visible in the TextArea. When I tap on the screen the cursor reappears.

 

The cursor disappears when I insert text at the cursor position.

 

Any idea why or how to control visibilty of cursor in this situation.

 

I know you probaably want to see the source code here it is

 

  textArea.editor.insertPlainText("plain text");

 

 

Retired
Posts: 418
Registered: ‎07-18-2012
My Device: Q10
My Carrier: Bell Canada

Re: Cursor (caret) not displaying in text area after insert of text or position change

Hi,

 

The cursor/caret isn't visible unless the TextArea is focused. Does code like this work for you?

 

        TextArea {
            id: ta
        }
        Button {
            text: "Click Me";
            onClicked: {
                ta.editor.insertPlainText("plainText");
                ta.requestFocus();
            }
        }

 Thanks.

 

--
Rob is no longer associated with BlackBerry.
Developer
Posts: 68
Registered: ‎11-12-2013
My Device: Z10
My Carrier: Rogers

Re: Cursor (caret) not displaying in text area after insert of text or position change

That was it, thanks! Tested both in QML and C++.

 

Works the way I want. I insert text and then position curso within the text where user needs to type

Highlighted
Retired
Posts: 418
Registered: ‎07-18-2012
My Device: Q10
My Carrier: Bell Canada

Re: Cursor (caret) not displaying in text area after insert of text or position change

Glad to hear it! Good luck with your app!

--
Rob is no longer associated with BlackBerry.