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
Highlighted
Developer
Posts: 426
Registered: ‎04-10-2011
My Device: Z30

onTextChanging events on TextArea/Field

As far as I can see, there are currently only two text events on TextArea/Field: onTextChanged and onTextChanging.

onTextChanged does what it should do (and what's in the documentation): emit when the TextArea looses focus.

onTextChanging doesn't work for me. It fires the same time as onTextChanged, so there's no way of reacting to a single character input (that is, what the documentation says).

Neither works for the TextArea nor the TextField.

-----------------------------------------------------------------------------
Check out my apps in the BlackBerry World
Visit my developer blog alopix.net
BBM Channel: C0047B612
Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: onTextChanging events on TextArea/Field

Play with sample cascadescookbookcpp.

Put a breakpoint in inputrecipe.cpp inside onTextChanging.

 

Debug.

 

Scroll down to input, click on a field and type a character.

==> breakpoint hit.

 

Is this not what you expect?

 

Stuart

Developer
Posts: 426
Registered: ‎04-10-2011
My Device: Z30

Re: onTextChanging events on TextArea/Field

I did it with changing a Label's text and this only happens after the TextArea loosing focus.
-----------------------------------------------------------------------------
Check out my apps in the BlackBerry World
Visit my developer blog alopix.net
BBM Channel: C0047B612
Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: onTextChanging events on TextArea/Field

Did we cross paths, or was that a response to my response?

I don't understand your response: can you reword it?  (I don't understand what you mean by "it" or "happens").

 

Did you try the sample?  It behaves exactly as I understand you want it to behave, for me.

 

Stuart

Developer
Posts: 426
Registered: ‎04-10-2011
My Device: Z30

Re: onTextChanging events on TextArea/Field

I did not try the example yet but I implemented an app using a TextArea (and Field) and changing a Label's text in the onTextChanging event of the TextArea/Field.
Nothing happens until ut looses the focus.
I just use QML and no C++.

Going to try the cookbook appt after the Google I/O keynote Smiley Wink
Maybe it's only a QML problem...
-----------------------------------------------------------------------------
Check out my apps in the BlackBerry World
Visit my developer blog alopix.net
BBM Channel: C0047B612
Developer
Posts: 426
Registered: ‎04-10-2011
My Device: Z30

Re: onTextChanging events on TextArea/Field

I just tried my own implementation again and added a console.log() and found out: it actually is firing for each click.

Unfortunately the Label's text is not updating until the TextArea looses focus. Is this intended or am I doing something wrong?

 

Sample code:

Page {
// ...
TextArea {
id: textInput
onTextChanging: {
calculate ();
}
}
Label {
id: charCountResult
text: "0"
}
function calculate () {
// do the calculation
charCountResult.text = result
}
// ...
}

 

-----------------------------------------------------------------------------
Check out my apps in the BlackBerry World
Visit my developer blog alopix.net
BBM Channel: C0047B612
Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: onTextChanging events on TextArea/Field

[ Edited ]

I was afraid you'd say that Smiley Sad

 

I hope to get a chance to play with this tomorrow.  In the meantime, check out the traffic light example, timerDisplay.  It uses a TextArea not a Label, but it might be interesting to try with a label to see what happens.  Also, it is updating on a timer not some other UI event, but this still might tell us something.

 

https://developer.blackberry.com/cascades/documentation/ui/signals_slots/signals_slots_set_up_projec...

 

Stuart

Developer
Posts: 426
Registered: ‎04-10-2011
My Device: Z30

Re: onTextChanging events on TextArea/Field

I didn't try it the tutorial way (no attatched Objects) but changed my Label to a TextArea or TextField. Both don't work.
The output's text property won't update until the input TextField/Area looses the focus (keyboard closes).
-----------------------------------------------------------------------------
Check out my apps in the BlackBerry World
Visit my developer blog alopix.net
BBM Channel: C0047B612
Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: onTextChanging events on TextArea/Field

In the cpp version of the cascadescookbook tutorial, the updated field is a label, and it is being updated in a timely fashion.

 

Stuart

Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: onTextChanging events on TextArea/Field

Better yet, the qml version of cascadescookbook, input, does exactly what you want.

 

Stuart