How to "leave" a Textbox

Hi and appologies if this is a dummy question, but I was not able to find an exisiting answer to this issue.

On my screen I have a series of textboxes and buttons.
I want to allow the user to edit the textboxes.
When the screen is initalized at beginning no text box is in text edit mode. This is exactly the state I want to get back to after the user edited on textbox. However I am unable to achieve this and need help for this.

If the user clicks a textbox the textbox get's the focus and switches into text edit mode. If the user now clicks somewhere else, e.g. a button the text box stays in edit mode and I am unable to stop this.
I am able to catche e.g. the lost focus event and e.g. close the keyboard but I am not able to leave the text edit mode. The text fields stays active and the cursor as ready for input. As stated above I would like to "fully leave" the textbox so that the UI looks the same way when the screen was opened.

Many thanks for your support.

Use another textbox, sized 1x1 pixels somewhere on screen. Give that the focus when you catch the lost focus event from one of your proper textboxes.

Thanks for the workaround. :grinning:
I was already thiking in this direction.

I wonder though if there is a "real" solution with somehow returning to the initial state.

You could always restart the app:

(works only in compiled app)

This focus behavior is typical for Android and is not unique to AI.
There is a method in Android called "clearFocus()" that will achieve what you want, but I haven't seen this in AI or any of the Publicly posted extensions.

I am considering whether to add it to one of my extensions or not.

I added ClearFocus to my TextBoxTools Extension, PM me if you'd like to try it:



Hi Ken, many thanks for the detailed explanation and all your efforts. Makes sense and I got the point now. I will 1st beta test my app next week to ensure everything else works as it should.
I may get back to you then to finetune also the focus topic.
Once again many thanks so far. :grinning:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.