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
New Contributor
noomen
Posts: 8
Registered: ‎08-30-2013
My Device: bbz10

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
slashkyle
Posts: 820
Registered: ‎10-16-2012
My Device: Red Z10

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
noomen
Posts: 8
Registered: ‎08-30-2013
My Device: bbz10

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
slashkyle
Posts: 820
Registered: ‎10-16-2012
My Device: Red Z10

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

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

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
slashkyle
Posts: 820
Registered: ‎10-16-2012
My Device: Red Z10

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
noomen
Posts: 8
Registered: ‎08-30-2013
My Device: bbz10

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
slashkyle
Posts: 820
Registered: ‎10-16-2012
My Device: Red Z10

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
slashkyle
Posts: 820
Registered: ‎10-16-2012
My Device: Red Z10

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.