-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InputText is invalid when create a second frame. #8173
Comments
Why the second frame, especially an empty one? Frames need to be continuous. The interaction with widgets happens mostly between frames. If you don't submit a widget for a frame, it cannot hold focus or do anything basically. That's expected behavior, not a bug. Your example code is not valid (it wouldn't compile when pasted into a test application) and leaves a few questions open. Are you using a wrapper? The functions of the C++ interface are in a namespace, they don't use an |
Thanks for feedback, the posted code is fake code, just for explaining my process. |
Frames need to be continuous to work properly. If you switch between two UIs in your main loop, you have two distinct frames each iteration. From the perspective of the library, windows and their widgets would blink on for a single frame only and then not exist for the next frame, effectively being destroyed and recreated constantly instead of just existing. No UI element could hold focus of even interact with the user that way. If you really need two UIs at the same time, you can create two ImGui contexts and switch between them, take a look at |
Clear, thanks. |
Version/Branch of Dear ImGui:
Branch: master
Back-ends:
imgui_impl_sdl2.cpp+imgui_impl_sdlrenderer2.cpp
Compiler, OS:
windows11 + mingw64
Full config/build information:
No response
Details:
I imported imgui into my game app on windows 11, thanks very much for you guys' great work.
I found the InputText will be invalid when create a second frame.
It just show there with no cursor blink and can not edit, like turned to be readonly.
I am not sure it is a bug, or imgui can create only one frame.
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
//new a frame and create my InputText
ImGui_NewFrame();
ImGui_Begin();
InputTextWithHint(xxx);
ImGui_End();
//close the frame and render
ImGui_ImplSDLRenderer2_RenderDrawData(ImGui::GetDrawData(), renderer);
//create another frame, the InputText is shown but can not focus and edit.
ImGui_NewFrame();
ImGui_EndFrame();
The text was updated successfully, but these errors were encountered: