TextEditor how to resign focus after user hits return


#1

Hi guys,

 

A quick (and maybe easy) question which stucked me for an hour......

I have a texteditor, and I have override the listener's textEditorReturnKeyPressed (TextEditor &te) method to make response.

I want to make the editor back to its normal appearance (i.e. resign the focus and get rid of the thicker border). However, I did not figure out a way to do this.

I found there is a static function in the online doc, will this be useful in my scenario?

Component::unfocusAllComponents()

I guess this static funtion is recently added to JUCE? Since I am using 2.0.40 and my juce does not recognize this func.

Any tips?

 

thanks!


#2

Just tried the newest unfocusAllComponents() but seems it is not for my usage for this condition..

The texteditor still has the focus after the unfocus was called.

http://i40.tinypic.com/27x12k1.jpg


#3

unfocusAllComponents will definitely get rid of the focus, so most likely you've got some other event that's putting it back afterwards?


#4

you are right jules. Tried another time and now works...