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

Can't hold focus on command input widget? #2

Open
hippyau opened this issue Feb 13, 2021 · 3 comments
Open

Can't hold focus on command input widget? #2

hippyau opened this issue Feb 13, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@hippyau
Copy link

hippyau commented Feb 13, 2021

Hi there!

I have working well with spdlog integrated too, but there is one big problem... I can't enter any commands.

It seems like everytime I click to enter text into the command input, it only holds focus for 1 frame.

I can only get something into the command input box if I hold a key on the keyboard while clicking the input box.

The tool tip appears for a frame, then disappears, then focus is lost.

problem1-2021-02-13_161948-high

video of problem here

It appears related to the tool tip, because if I get a 'c' into the box (by holding c and clicking the input box to get focus) the problem continues, but once I have two 'c' in the box, it starts to work perfectly, presumably because there are no commands starting with 'cc'. To clarify, once I have got 'cc' into the text input then it behaves normally right up until I press enter, or backspace one 'c'. So seems like somehow the popup completion hint is stealing the focus before I can even try anything?

Using the ImGui 1.80, no compiler errors or warnings, I am using the example code as such...

I brought the ui_terminal_commands.* straight from the example, and in my draw loop....

// Terminal
    static custom_command_struct cmd_struct; // terminal commands can interact with this structure
    static ImTerm::terminal<terminal_commands> terminal_log(cmd_struct);
    static bool once = true;
    static bool showing_term = true;
    if (once){ // do this only once
        terminal_log.set_min_log_level(ImTerm::message::severity::info);
        spdlog::set_level(spdlog::level::trace);
        spdlog::default_logger()->sinks().push_back(terminal_log.get_terminal_helper());        
        once = false;
    }
    if (showing_term) {		
			showing_term = terminal_log.show();
			if (cmd_struct.should_close) {
				//window.close();  // quit?
			}
    }
    // End Terminal
@Organic-Code
Copy link
Owner

Hello

I will try to dig into this, unfortunately I won’t have much time until the end of february

In the mean time, you can try to revert back to imgui 1.74, which is the version I used when developping ImTerm, and see if that helps

@Organic-Code Organic-Code added the bug Something isn't working label Feb 13, 2021
@IcyTv
Copy link

IcyTv commented Aug 20, 2021

The Issue is the call to ImGui::SetNextWindowFocus() in show_autocomplete(). Commenting it out fixed the issue (at least on the docking branch of ImGui). I don't know however if that breaks anything else...

@fabio-polystream
Copy link

This also happens with the basic_terminal_helper. Just commenting out that line fixes the issue. It is not fixed by #4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants