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'm trying to create a simple input mechanic that the player can type words and commit them to do some actions.
My idea is that every time the player press enter, it will send that text to another widget (a history box) and check if that word should do anything.
However, whenever I press enter, the text gets selected and I can't clear it. I tried with different flags, no flags, and with the ImGui::IsItemDeactivatedAfterEdit() as well.
Basically, I want to be able to have a similar functionality as the ESC key with the ENTER key.
Any help is appreciated, I am stuck in this for a couple days now.
Screenshots/Video:
Eternal.Ascent.2024-03-23.00-01-11.mp4
Minimal, Complete and Verifiable Example code:
// In the loop Update()
static std::string myInput;
if(ImGui::InputText("Input", &myInput, ImGuiInputTextFlags_EscapeClearsAll | ImGuiInputTextFlags_EnterReturnsTrue)) {
// Send this text to another widget
// clear the current text.
myInput.clear();
}
The text was updated successfully, but these errors were encountered:
Version/Branch of Dear ImGui:
Version 1.90, Branch: docking
Back-ends:
imgui_impl_dx12.cpp + imgui_impl_win32.cpp
Compiler, OS:
Windows 10 - Rider
Full config/build information:
Details:
I'm trying to create a simple input mechanic that the player can type words and commit them to do some actions.
My idea is that every time the player press enter, it will send that text to another widget (a history box) and check if that word should do anything.
However, whenever I press enter, the text gets selected and I can't clear it. I tried with different flags, no flags, and with the
ImGui::IsItemDeactivatedAfterEdit()
as well.Basically, I want to be able to have a similar functionality as the ESC key with the ENTER key.
Any help is appreciated, I am stuck in this for a couple days now.
Screenshots/Video:
Eternal.Ascent.2024-03-23.00-01-11.mp4
Minimal, Complete and Verifiable Example code:
// In the loop Update()
The text was updated successfully, but these errors were encountered: