-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
How to set active docked window? #5005
Comments
Would |
It partially does. I didn't know that function existed up until now, I just tried it and it "solves" my problem. However, my windows have complicated names. They are in the form of: If we had Is this easy to implement? If so, maybe I can look into it. I'm asking because I'm not an experienced programmer. |
I am not sure what data you have on your side, but would one of these be of help?
They can be found in |
I don't understand how finding the pointer to the window would help me. I can't find a function in ImGuiWindow class that would focus the window. Maybe I'm missing it, can you help me find it? By the way, all these focus related functions only work if the window in question exists (naturally, since it's impossible to find and then focus a non-existent window) but I would like to do this "focusing" (setting selected dock window) while I'm building my dock layout, but the problem is my windows don't exist yet. They
|
You should not look for functions using the window pointer, but rather the information contained in the struct. It seemed like that would be able help you (I am now aware it will not). Also, I forgot you cannot pass Have you tried changing this:
to this:
|
If I change the order of the lines, the order of the docked windows change. I want to keep the order in which they are docked, but I want to focus some window other than the last docked one. |
A workaround would be to have one frame render with the ImGui focus function at the end of the loop (seperate from your main loop) and after that you start calling your normal main loop. That is what I do for the dock builder. I have a |
I think users shouldn't be forced to circumvent this issue. The DockBuilder API should support this feature. What do you think about this @ocornut? I would try to implement this feature and create a PR but I think my abilities are subpar compared to the people who are maintaining this project. |
@aeris170 ImGui::FocusWindow(ImGui::FindWindowByID(id)) |
Sorry for not answering been busy and likely won't solve it ASAP but @aeris170 is right that this should be possible before the windows are submitted. That's even the whole reason the DockBuilder API takes strings for window, because it is acting both on persisting settings + runtime window data. I think using |
No worries @ocornut ! I know you are a busy man, and I'm aware you are providing all of this free of charge, so the least I can do would be waiting :) Coming to your suggestion: I applied it but it doesn't work, as you've predicted. The focusing and order seems to depend on the order of rendering of windows. For example;
and later,
would lead to B getting the focus (selected) instead of A. If I change the order of Begin's then A gets the focus. Changing the order of windows also seems to effect the order of tabs. If I render B before A, A gets the focus but A is the second tab and B is the first tab. We should probably desire to seperate the order of windows and order of tabs/default focused window. "But how?" is the question here, and I, sadly, don't have an answer to that. Here is a screenshot, if I couldn't make myself clear: I understand this one is a tough one to crack (because of #2304 ) so how should we proceed from here? |
You didn’t use the TabId as in my code snippet, that changed in 1.87.
|
I'm sorry, I thought if I passed "###ID" for id, everything would be fine. What is meant by "#TAB" and "window_name"? Lets say my window has the name "Hello there!###hello_window", should I use your code snippet as |
First of all we need to know which version are you on, which was omitted from the requested Issue Template.
Then use the window name.. But it'll depend on your version. |
I'm on 1.87 WIP docking branch, I included config details in my original post. I'll make sure it's included in my future issues. Here is how I now set up my dockspace:
Sadly, it didn't work for me. |
Hello! ImGui::DockBuilderDockWindow("Inspector", inspectorNode);
ImGui::DockBuilderDockWindow("Debug", inspectorNode);
ImGui::DockBuilderGetNode(inspectorNode)->SelectedTabId = ImHashStr("#TAB", 0, ImHashStr("Inspector", 0, 0)); and this change nothing, the inspector tab is not selected. Debug is always selected. And I don't know why, change DockBuilderDockWindow lines order does not change tabs order. |
I'm building my dock layout like so:
I'm docking WINDOW3 and WINDOW4 to the same node, and they are docked but since I docked WINDOW4 after WINDOW3, WINDOW4 comes up as the "selected" dock window. How can I dock WINDOW4 after WINDOW3 but make WINDOW3 come up as the selected dock window programatically?
What happens when I open my program:
What I want to happen when I open my program:
Here is my build info:
The text was updated successfully, but these errors were encountered: