You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I apologize if this is basic or has been answered, but I searched around imgui.h and couldn't find the answer.
Is there a way to defocus a text input? SetKeyboardFocusHere focuses the input, is it possible to do the opposite?
Edit: I just saw #5611. Unfortunately, in my case I can't just defocus the whole window as I really am trying to just defocus the input. The aforementioned issue mentions SetNavID(0) but the actual signature of SetNavID() has several more parameters, and it's not clear from the example calls in imgui_widgets.cpp how this is done. Any advice here would be greatly appreciated.
Edit 2: I tried SetNavID(0, GImGui->NavLayer, 0, ImRect()) and it didn't do anything.
and although it appears to work, it seems awkward and implicit (is it well defined that unfocusing the window reliably clears keyboard focus?). Would still love a better way.
Edit 4: Okay, last edit. I dug around what SetWindowFocus(NULL) was doing and guessed that ClearActiveID() would do the trick, which turned out to be correct.
The text was updated successfully, but these errors were encountered:
Note that defocusing wouldn't constitute a validation, and features like #701 or issues like #4714 (finger crossed finishing the fix soon) there are different alternative ways you would want to "defocus text input": defocus and revert? defocus on leave as it, but if we add #701 does it means the current value is lost? defocus with explicit validation, etc. Future users may be mindful of those.
I apologize if this is basic or has been answered, but I searched around imgui.h and couldn't find the answer.
Is there a way to defocus a text input?
SetKeyboardFocusHere
focuses the input, is it possible to do the opposite?Edit: I just saw #5611. Unfortunately, in my case I can't just defocus the whole window as I really am trying to just defocus the input. The aforementioned issue mentions
SetNavID(0)
but the actual signature ofSetNavID()
has several more parameters, and it's not clear from the example calls in imgui_widgets.cpp how this is done. Any advice here would be greatly appreciated.Edit 2: I tried
SetNavID(0, GImGui->NavLayer, 0, ImRect())
and it didn't do anything.Edit 3: I tried
and although it appears to work, it seems awkward and implicit (is it well defined that unfocusing the window reliably clears keyboard focus?). Would still love a better way.
Edit 4: Okay, last edit. I dug around what
SetWindowFocus(NULL)
was doing and guessed thatClearActiveID()
would do the trick, which turned out to be correct.The text was updated successfully, but these errors were encountered: