Open katemonster33 opened 9 months ago
There are multiple questions there.
I am not sure you can satisfy all your needs precisely but you can start there.
(Edit: Omar beat me to it 😅)
This feels very XY problem and feels like a very odd things to do, it'd help to know what exactly you're trying to accomplish (from a user perspective) and why.
That being said, if I am understanding you correctly you can accomplish most of what you want by passing ImGuiWindowFlags_NoBringToFrontOnFocus
to ImGui::Begin
.
However windows with that flag will automatically appear behind all other windows (which sounds like the opposite of what you're wanting.) You can manually bring them to the front as a workaround:
if (ImGui::IsWindowAppearing())
ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindow());
(Note that BringWindowToDisplayFront
and GetCurrentWindow
are internal functions and require including imgui_internal.h
)
@PathogenDavid I am working on Cataclysm: Dark Days Ahead. My specific branch is here: https://github.com/katemonster33/Cataclysm-DDA/tree/imgui-integration we are overhauling the old ncurses based (terminal) UI with ImGui and there are lots of weird use cases I am trying to account for. For instance, the basic "dialog" window (a.k.a. a "yes/no/cancel/etc" dialog) can show the "keybindings" screen over itself if the user types the '?' key (the shortcut for keybindings) - this is in case the user needs to know which keybindings are supported on that particular dialog. The keybindings UI can also show a dialog. For this reason I implemented Cataclysm's dialog as a Window rather than a Popup.
The specific use case here is that the keybindings screen shows a dialog asking the user if they are sure they want to change a keybinding. The dialog displays at the center of the screen, and as a regular ImGui window, and because the windows are marked as not resizable or movable (by design), if the user clicks the keybindings screen while the popup is shown, the popup goes behind the keybindings screen and is not able to be re-focused.
It might also correlate to manual z-order manipulation (#983 #1328) but we don't have a good solution for that yet. I think at some point we will as I've seen some orders using windows to track on-screen 3D object and they want to control their relative depth.
We were able to solve the issue enough with the ImGuiWindowFlags_NoBringToFrontOnFocus flag .
We were actually able to get ImGui support merged into Cataclysm and you can see it in latest experimental builds on GH :) uses ImTui on Linux curses builds to draw using ncurses in a terminal, and SDL backend on everything else.
I think in a perfect world, what we would like is to set a boolean in ImGui to freeze the Z order of all windows to the order they are created in using Begin(). But, what we have right now works just fine.
Version/Branch of Dear ImGui:
1.89.6
Back-ends:
imgui_impl_sdl2.cpp +imgui_impl_sdlrenderer2.cpp, imtui-impl-ncurses.cpp + imtui-impl-text.cpp
Compiler, OS:
MSVC, mac os/clang, linux/clang, linux/gcc
Full config/build information:
Details:
I want to disable window management. I want my windows to display in the order of the Begin() statements, and not allow mouse movements or Shift+Tab to change the order. I tried using BeginDisabled, and ImGuiWindowFlags_NoInput on windows that are not on top, but still I am able to use the mouse to put the disabled window over top of the enabled window. I understand what I am describing sounds ideal for Popups, but the way the game I am working on is coded, sometimes the "Popup" would be the only window shown. Is this possible currently?
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code: