InputText : how to force ENTER/validation while the widget is active ? #3290

Closed
opened 2020-06-07 17:44:44 +00:00 by DaveInDev · 3 comments
DaveInDev commented 2020-06-07 17:44:44 +00:00 (Migrated from github.com)

Version: Dear ImGui 1.77 WIP (17601)
Branch: master
Back-ends: SFML
Compiler: VS2019 c++
Operating System: win10x64

Hi Omar @ocornut

I use an Inputtext widget, and in some cases, while the user is editing the text, I need to force the widget to lose Keyboard focus and validate its current state (as if the user was pressing ENTER).

Is there a way to do that ?

Version: Dear ImGui 1.77 WIP (17601) Branch: master Back-ends: SFML Compiler: VS2019 c++ Operating System: win10x64 Hi Omar @ocornut I use an Inputtext widget, and in some cases, while the user is editing the text, I need to force the widget to lose Keyboard focus and validate its current state (as if the user was pressing ENTER). Is there a way to do that ?
ocornut commented 2020-06-09 13:39:51 +00:00 (Migrated from github.com)

InputText() will update the underlying character data while inputting so it should always be up to date.

Would be good to know more about your context, calling ClearActiveID() is one way to clear focus on the InputText() (which is not what you asked for but I feel is likely what you need).

`InputText()` will update the underlying character data while inputting so it should always be up to date. Would be good to know more about your context, calling `ClearActiveID()` is one way to clear focus on the `InputText()` (which is not what you asked for but I feel is likely what you need).
DaveInDev commented 2020-06-09 17:31:50 +00:00 (Migrated from github.com)

Thx Omar ! Once again you did a very good job finding out what I really need. ClearActiveID() works perfectly for me.

Th exact problem was: in some occasion this InputText MUST be filled with a new value, even if the user is working on it. And for the moment, if the user was editing it, I was not able to change the underlying value, and the result was all messed up and not logical. Now, I just have to ClearActiveID to get back the control of this InputText , and everything can work as intended.

Thx Omar ! Once again you did a very good job finding out what I really need. ClearActiveID() works perfectly for me. Th exact problem was: in some occasion this InputText MUST be filled with a new value, even if the user is working on it. And for the moment, if the user was editing it, I was not able to change the underlying value, and the result was all messed up and not logical. Now, I just have to ClearActiveID to get back the control of this InputText , and everything can work as intended.
ocornut commented 2020-06-09 17:33:47 +00:00 (Migrated from github.com)

Linking to #2881, #2890

Linking to #2881, #2890
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#3290
No description provided.