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 disable focus? #3941

Closed
aFakeCmd opened this issue Mar 19, 2021 · 4 comments
Closed

InputText disable focus? #3941

aFakeCmd opened this issue Mar 19, 2021 · 4 comments

Comments

@aFakeCmd
Copy link

aFakeCmd commented Mar 19, 2021

Version/Branch of Dear ImGui:
35b1148
Version: 1.82
Branch: release

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_win32.cpp + imgui_impl_dx9.cpp
Operating System: win 10 x64

My Issue/Question:

Hey! How to turn off focus inputtext?
I have the same problem as in #2881, but its solution does not help me. When inputtext is active, I cannot apply the value to the variable

Screenshots/Video

6666ый

@ocornut
Copy link
Owner

ocornut commented Mar 19, 2021

Didn't follow requested guidelines or issue template.

  • Please make sure you have read the guidelines.
  • Please edit your post (don't create a new post) with the Issue Template shown in "New Issue" and reply here when edited.

Closing.

@aFakeCmd
Copy link
Author

updated

@ocornut ocornut reopened this Mar 19, 2021
@ocornut
Copy link
Owner

ocornut commented Mar 19, 2021

Clearing focus can be done by calling ImGui::ClearActiveID() from imgui_internal.h
You may also do something like:

if (ImGui::GetActiveID() == ImGui::GetID("my_input_text_label"))
    ImGui::ClearActiveID();

I believe we still ought to solve #2881 and the one million issues of people trying to alter text value while editing, hopefully we can solve that soon.

@aFakeCmd
Copy link
Author

if (ImGui::GetActiveID() == ImGui::GetID("my_input_text_label"))
    ImGui::ClearActiveID();

Ohh, this is an easy way to fix my problem! Thank!

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

No branches or pull requests

2 participants