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
Contributor
Posts: 45
Registered: ‎03-02-2012
My Device: Torch 9810
My Carrier: Vodafone
Accepted Solution

Determine if an element has focus

Hello,

I think the subject is pretty explicative.

Using C++, I need to know if a particular TextField had focus. I have a function that is connected to the "onTextChanging" event of many TextFields.

 

I see that I have to set manually the new text, I'm using as a reference the speed writer sample. But how can I decide which one is the right one?

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

Re: Determine if an element has focus

I haven't tried this in Cascades, but in Qt if you have a signal handler in C++ you can call sender().  Are you trying to do this from C++ or javascript?

 

Stuart

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

Re: Determine if an element has focus

Check out sample app Stamp Collector, StampCollectorApp::smileysurprised:nSelectionChanged.

This uses sender() to find the right object.

(Note: you can do the dynamic_cast directly on sender() without checking if it is null, but you must check that the pointer returned from dynamic_cast is non-null)

 

Stuart

Contributor
Posts: 45
Registered: ‎03-02-2012
My Device: Torch 9810
My Carrier: Vodafone

Re: Determine if an element has focus

**bleep**, I was using it as a property... -_-'

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

Re: Determine if an element has focus

So are you past this issue?

If so, please mark a thread as the solution.

If not, how can we help?

 

Stuart

Contributor
Posts: 45
Registered: ‎03-02-2012
My Device: Torch 9810
My Carrier: Vodafone

Re: Determine if an element has focus

Sure, I just did it.
Thanks.