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
The ImGui::InputText() function is behaving unexpected (to me). It might be a bug.
I'm passing the flags ImGuiInputTextFlags_EnterReturnsTrue and ImGuiInputTextFlags_EscapeClearsAll to ImGui::InputTextWithHint() (actually I'm using the overload in imgui_stdlib which operates on a std::string, though I checked the code and I don't believe that's relevant). Because I'm passing EnterReturnsTrue (I need to know when the Enter key was pressed) the return-value no longer signals when some edit was made. Therefor I'm also passing ImGuiInputTextFlags_CallbackEdit and a custom callback function.
My expectation was that this callback would trigger on all edits. That's mostly true, except when ESC is pressed to clear the input. I checked that without EnterReturnsTrue, the function does return true on ESC (so CallbackEdit is not a 100% replacement for this return value).
Some background info:
I'm using this to implement a console interface. I'm calling ImGui::InputTextWithHint() with ImGui::PushStyleColor(ImGuiCol_Text, 0) to disable drawing. Soon after I do draw the text myself with custom syntax highlighting (and with some hacks using imgui_internal.h to also draw the cursor). Because syntax highlighting involves non-trivial parsing, I prefer to not have to do that on every frame. Therefor I'd like to know if some edit was made. I was hoping to use ImGuiInputTextFlags_CallbackEdit for that.
The workaround I'm using now is: make a copy of the string before calling InputText() and then check if the string was changed. This works, and it's not super expensive, but it would be nice if this can be avoided. (But it's fine for me to give this issue lower priority).
Thanks.
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
No response
The text was updated successfully, but these errors were encountered:
Version/Branch of Dear ImGui:
Version 1.91.6, Branch: docking
Back-ends:
imgui_impl_opengl3.cpp + imgui_impl_sdl2.cpp
Compiler, OS:
Linux + gcc
Full config/build information:
Details:
The ImGui::InputText() function is behaving unexpected (to me). It might be a bug.
I'm passing the flags
ImGuiInputTextFlags_EnterReturnsTrue
andImGuiInputTextFlags_EscapeClearsAll
toImGui::InputTextWithHint()
(actually I'm using the overload inimgui_stdlib
which operates on astd::string
, though I checked the code and I don't believe that's relevant). Because I'm passingEnterReturnsTrue
(I need to know when theEnter
key was pressed) the return-value no longer signals when some edit was made. Therefor I'm also passingImGuiInputTextFlags_CallbackEdit
and a custom callback function.My expectation was that this callback would trigger on all edits. That's mostly true, except when ESC is pressed to clear the input. I checked that without
EnterReturnsTrue
, the function does returntrue
on ESC (soCallbackEdit
is not a 100% replacement for this return value).Some background info:
I'm using this to implement a console interface. I'm calling
ImGui::InputTextWithHint()
withImGui::PushStyleColor(ImGuiCol_Text, 0)
to disable drawing. Soon after I do draw the text myself with custom syntax highlighting (and with some hacks usingimgui_internal.h
to also draw the cursor). Because syntax highlighting involves non-trivial parsing, I prefer to not have to do that on every frame. Therefor I'd like to know if some edit was made. I was hoping to useImGuiInputTextFlags_CallbackEdit
for that.The workaround I'm using now is: make a copy of the string before calling
InputText()
and then check if the string was changed. This works, and it's not super expensive, but it would be nice if this can be avoided. (But it's fine for me to give this issue lower priority).Thanks.
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
No response
The text was updated successfully, but these errors were encountered: