Skip to content
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

Open
kindred77 opened this issue Nov 22, 2024 · 1 comment
Open

InputText is invalid when create a second frame. #8173

kindred77 opened this issue Nov 22, 2024 · 1 comment

Comments

@kindred77
Copy link

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();

@GamingMinds-DanielC
Copy link
Contributor

GamingMinds-DanielC commented Nov 22, 2024

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 ImGui_ prefix. Also Begin() has no default value for its first parameter, the window title. If you are using a wrapper and that has a default, maybe what you are trying to make is a second window, not a second frame. You would have to submit the second window within the same frame.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants