Open blastrock opened 6 years ago
Hello,
Navigation visuals are activated when using the keyboard/gamepad keys and deactivated when using the mouse.
That is regardless of SetItemDefaultFocus()
calls which should be setting the current navigation id but is navigation visuals are disabled you won't see them.
I think we need to design new function calls to alter those state. They are internally represented by two internal fields in the imgui context:
bool NavDisableHighlight
bool NavDisableMouseHover
In most cases those fields are in opposite state (NavDisableHighlight is false when NavDisableMouseHover is true etc.) but there are a few situations where they aren't, so it's not a simple binary state. We need to clarify this further to be able to design a suitable api.
context->NavDisableHighlight = false
seems to solve my problem for the moment, thanks!
I would love to have a public API to do that :)
Me too. I have such API in my own imgui extension.
Version/Branch of Dear ImGui:
master (73fa5c29)
Back-end file/Renderer/OS:
Back-ends: imgui_impl_opengl3.cpp and custom engine OS: Linux Compiler: Clang 6.0
My Issue/Question:
I may have diagnosed this wrong, but it seems to me that if the application just started and navigation has never been used (you never pressed up/down etc), SetItemDefaultFocus does nothing. I couldn't find a way to force navigation to initiate, as if the user had pressed a navigation key once.
Standalone, minimal, complete and verifiable example:
In
example_sdl_opengl3/main.cpp
Start the application, and the button will not be focused. However, if I use the keyboard to open another window with similar code, it works, the button is focused.