ImGui::SetKeyboardFocusHere doesn't highlight selected item #7370
Closed
Description
Version/Branch of Dear ImGui:
Version 1.90.0, Branch: docking
Back-ends:
imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp
Compiler, OS:
Windows 10
Full config/build information:
No response
Details:
Hello,
I am trying to make a programmable change of the focus of the keyboard on the item using SetKeyboardFocusHere();; I've noticed that the highlight is not applied while doing so. I would like to get a highlight on this item in the same way as when the down/up navigation keys are pressed. The object in this case does not lose the highlight when the mouse is moved away.
Example code:
ImGui::Selectable(std::format("Name: \"{0}\"", (t->m_name.c_str()) ? t->m_name.c_str() : "").c_str());
if (ImGui::IsItemClicked())
{
SetKeyboardFocusHere();
}
ImGui::Selectable(std::format("Mask Name: \"{0}\"", (t->m_mask_name.c_str()) ? t->m_mask_name.c_str() : "").c_str());
if (ImGui::IsItemClicked())
{
SetKeyboardFocusHere();
}
ImGui::Selectable(std::format("Width: {0}", t->m_width).c_str());
if (ImGui::IsItemClicked())
{
SetKeyboardFocusHere();
}
Screenshots/Video:
Minimal, Complete and Verifiable Example code:
No response