-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
ImGui::InputText - Passing in first argument as empty string ("") makes the text box constantly lose focus #7246
Copy link
Copy link
Closed
Labels
label/id and id stackimplicit identifiers, pushid(), id stackimplicit identifiers, pushid(), id stack
Description
Version/Branch of Dear ImGui:
Version 1.90.1, Branch: master
Back-ends:
imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler, OS:
Arch Linux + G++
Full config/build information:
No response
Details:
If you pass in an empty string into the first argument of ImGui::InputText whenever it gets rendered it will unfocus, and you cannot type anything.
ImGui::InputText("", coolTextField, sizeof(coolTextField);
Everything compiles completely fine, you only see the issue once you run the compiled binary.
It can be an annoyance if you don't want any text to display next to the box, my hacky workaround was to pass in a "\t" like so:
ImGui::InputText("\t", coolTextField, sizeof(coolTextField));
Apologies in advance if I did something wrong, or this has been posted. I did look but I couldn't find anything myself.
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
// Here's some code anyone can copy and paste to reproduce your issue
ImGui::Begin("InputText Bug: Empty label unfocus");
char coolTextField[32];
ImGui::InputText("", coolTextField, sizeof(coolTextField));
ImGui::End();Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
label/id and id stackimplicit identifiers, pushid(), id stackimplicit identifiers, pushid(), id stack