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
bb10H36
Posts: 46
Registered: ‎11-12-2013
My Device: Z10
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");

 

 

Please use plain text.
BlackBerry Development Advisor (Retired)
robbieDubya
Posts: 418
Registered: ‎07-18-2012
My Device: Q10

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.
Please use plain text.
Developer
bb10H36
Posts: 46
Registered: ‎11-12-2013
My Device: Z10

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

Please use plain text.
BlackBerry Development Advisor (Retired)
robbieDubya
Posts: 418
Registered: ‎07-18-2012
My Device: Q10

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.
Please use plain text.