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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
New Contributor
Posts: 8
Registered: ‎08-30-2013
My Device: bbz10
My Carrier: fido

Cascades -> TextArea -> TextEditor -> QML properties not returning the correct values and not triggering the selectedTextChanged signal

Run the following sample code, type any text in AreaText then select a couple of words, then hit check button:

 

1. selectedTextChanged never been triggered

2. selectedText return empty text

3. selectionStart return the correct value

4. selectionEnd return always the save value as selectionStart

 

        TextArea {
            id: TextAreaId
            text: ""
            onCreationCompleted: {
                console.log("TextArea onCreationCompleted");
                editor.selectedTextChanged.connect(handleSelectionChanged);
            }
        }

        Button {
            text: "Check"
            
            onClicked: {
                console.log("cur pos:" + TextAreaId.editor.cursorPosition + " selectedText:" + TextAreaId.editor.selectedText + " start: " + TextAreaId.editor.selectionStart + " end: " + TextAreaId.editor.selectionEnd);         
            }
        }

     function handleSelectionChanged(selectedText) {
        console.log("handleSelectionChanged:" + selectedText);
    }


Anything wrong with the above code ? or is it a bb10 bug ?

 

Thanks

Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Cascades -> TextArea -> TextEditor -> QML properties not returning the correct values and not triggering the selectedTextChanged signal

[ Edited ]

Are you trying to tell if they change the text? or select the text?

 

if change, you could use onTextChanged to get updated when the text is changed

 

TextArea {
   text: ""
onTextChanging: {
console.log("text is changing")
} onTextChanged: { //handleSelectionChanged } }

 possibly connect it with the return key to know when they're done editing text

New Contributor
Posts: 8
Registered: ‎08-30-2013
My Device: bbz10
My Carrier: fido

Re: Cascades -> TextArea -> TextEditor -> QML properties not returning the correct values and not triggering the selectedTextChanged signal

I was talking about the selected text in TextArea control

Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Cascades -> TextArea -> TextEditor -> QML properties not returning the correct values and not triggering the selectedTextChanged signal

New Contributor
Posts: 8
Registered: ‎08-30-2013
My Device: bbz10
My Carrier: fido

Re: Cascades -> TextArea -> TextEditor -> QML properties not returning the correct values and not triggering the selectedTextChanged signal

TextEditor is not a QML control, so cannot be used for the UI. So I have to use TextArea and then use TextArea.editor for anything related to selection / edition.

Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Cascades -> TextArea -> TextEditor -> QML properties not returning the correct values and not triggering the selectedTextChanged signal

Hmm sorry for the confusion earlier.  I did test it out and it appears onSelectedTextChanged doesnt get called at all but onCursorPositionChanged updates the cursor as you're moving the selection

 

TextArea {
        editor.onSelectedTextChanged: {
                 console.log("selectedTextChanged" + selectedText)
                 testLabel.text = selectedText
        }
        editor.onCursorPositionChanged: {
                   console.log("cursorPositionChanged" + cursorPosition)
         }
}
Label {
      id: testLabel
}

 unless there's something else that needs to be done to get the seleted text, which i dont think there is you may want to file a bug report 

https://www.blackberry.com/jira/secure/Dashboard.jspa

New Contributor
Posts: 8
Registered: ‎08-30-2013
My Device: bbz10
My Carrier: fido

Re: Cascades -> TextArea -> TextEditor -> QML properties not returning the correct values and not triggering the selectedTextChanged signal

Thanks for the confirmation that is not working. even this link https://www.blackberry.com/jira/secure/Dashboard.jspa

not working for me. I will try later today

Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Cascades -> TextArea -> TextEditor -> QML properties not returning the correct values and not triggering the selectedTextChanged signal

[ Edited ]

Sometimes Jira can take a while to open intially

 

I created a ticket on the issue

 

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

 

it may or may not take a few hours to be accessible

Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Cascades -> TextArea -> TextEditor -> QML properties not returning the correct values and not triggering the selectedTextChanged signal

[ Edited ]

Just an update, the ticket regarding this has been escalated and an ID # was provided

 

MKS DevTask ID   507731

 

It is likely that this could be fixed with 10.2 launch If it's vitally important, I reccommend keeping up with the leaks to see if you can spot when it's fixed.  If it's not fixed by the time 10.2 rolls around leave a comment in jira letteting them know the issue still persists.