How exactly does a text box lose focus?

I have a search function in my app that shows a text box with a slide in animation when clicked and automatically requests focus on the text box.

I wanted to make it that this animation is reversed and the screen goes back to normal(without the text box) if the user clicks anywhere outside the text box.

I figured that the function (when textbox lost focus…DO… ) is able to do that because normally the text box should lose focus when ever the user clicks something else, but apparently nothing cause text box to lose focus , not clicking something else or even finishing typing. if this is true this function is useless or is something wrong in the companion?

the question remains how do I reverse the animation when the user clicks on something else other than the text box?

A textbox loses focus when the focus moves to another textbox.
You can create a textbox size 1x1 pixel somewhere, then give this textbox focus programmatically when other components are selected.

Thanks it worked. I tried something similar but made the other textbox hidden and it didn’t work. the 1px solution worked.

Probably easiest to use Taifun’s TextBox extension for what you want.