Skip to content

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

Description

@hippyau

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions