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

Remove InputText focus #4342

Open
Slluxx opened this issue Jul 20, 2021 · 1 comment
Open

Remove InputText focus #4342

Slluxx opened this issue Jul 20, 2021 · 1 comment

Comments

@Slluxx
Copy link

Slluxx commented Jul 20, 2021

Hey,

i have multiple InputText's in a popup modal. I need to figure out how to check if a textInput has been pressed, execute a function and after that, give the focus to the parent again so the function does not get executed the next frame too (or any other way of checking if the previous element has been selected/clicked/has a cursor in it and removing it). Ive tried several things. This is one of my examples:

        ImGui::InputText ("User", 
        const_cast<char*>(jUser.data ()),
        jUser.size ()+1,
        0);

        if(ImGui::GetIO().WantTextInput && ImGui::IsItemActive()){
            j_windows["loginWindow"]["displayData"]["username"] = helper.getKeyboardInput();
            ImGui::CaptureKeyboardFromApp(false);
            ImGui::SetKeyboardFocusHere(-1);
        }

I cant give the previous element a focus because with a second textbox under the first one, it would just push the focus "up" one.

Note: "helper.getKeyboardInput();" opens a native touch keyboard on my device and returns whatever has been typed into " j_windows["loginWindow"]["displayData"]["username"]", which on the next frame is inside "jUser.data()". At least that was my plan.

Even though i didnt fill out the template, i still hope i can get some help.

@Slluxx Slluxx changed the title Remove textInput focus Remove InputText focus Jul 20, 2021
@NicWoo90
Copy link

NicWoo90 commented Mar 3, 2023

#6208

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

3 participants