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

Cannot reorder docking tab (focus/id conflict) #2363

Closed
r-lyeh opened this issue Feb 18, 2019 · 5 comments
Closed

Cannot reorder docking tab (focus/id conflict) #2363

r-lyeh opened this issue Feb 18, 2019 · 5 comments
Labels

Comments

@r-lyeh
Copy link

r-lyeh commented Feb 18, 2019

At some point one of my tabs went out of focus even if no other tab was overlapping at all. Couldnt give that bar any kind of focus with mouse. Fixed it by reordering layout of surronding tabs. Cannot give repro steps for this.

Originally posted by @r-lyeh in #2353 (comment)

@r-lyeh
Copy link
Author

r-lyeh commented Feb 18, 2019

I dunno if it is related to this very same issue but I found another tab of mine which, once docked, won't move or detach anymore. I suspect the two issues are related maybe?

PS: I'd like to create a small test case for this, but it may be just much easier if you just recompile my editor and give it a go? the tab that wont undock is the 'log' tab :D

@ocornut ocornut changed the title Bug: cannot reorder tab (z-order issue?) Cannot reorder docking tab (z-order issue?) Feb 18, 2019
@ocornut
Copy link
Owner

ocornut commented Feb 19, 2019

I cannot take the first bug without more information (screenshot/repro).

The second one we established your code was stealing the active widget every frame.

@r-lyeh r-lyeh closed this as completed Feb 19, 2019
@r-lyeh
Copy link
Author

r-lyeh commented Feb 19, 2019

Got a tab that was auto stealing focus and preventing from undocking. Thx Omar :D

@r-lyeh r-lyeh reopened this Feb 19, 2019
@r-lyeh
Copy link
Author

r-lyeh commented Feb 19, 2019

The issue persists after disabling all auto-focus code.
Oddly enough, these are the lines that prevent Log tab from undocking, ideas?

static ImGuiTextFilter filter;

ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0));
filter.Draw("", -1); // <-- comment to fix issue
ImGui::PopStyleVar();

@ocornut
Copy link
Owner

ocornut commented Feb 20, 2019

OK.

So, by using an empty ID "" at the root of the window you are currently conflicting with the window itself which uses "window_name" as an ID for the tab. Your InputText will use "window_name" + "" which is the same.

You should always use an ID for your element, e.g
filter.Draw("##blah", -1);

I have an ongoing task to make tabs use a different ID e.g. ("window_name" + "##TAB") to make this kind of error less problematic.

Been also considering changing my mind on #1414 because even though there are legit use, people make this error of using empty ID too frequently.

@ocornut ocornut closed this as completed Feb 20, 2019
@ocornut ocornut changed the title Cannot reorder docking tab (z-order issue?) Cannot reorder docking tab (focus/id conflict) Feb 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants