Open TomyFrank opened 2 weeks ago
What’s the actual problem you are aiming to solve?
It’s difficult to answer your questions with a simple yes/no answer, there are most things rights but vocabulary can be slippery or misleading.
Some out of order elements to help understand this:
The back of the stack is used as a seed for computing ids at that level of the stack.
The specific ID at the top of the window is based on its name, so in the specific case of popups it would be based on a mangled name that doesn’t match the ID as perceived in the OpenPopup(), but that usually doesn’t matter to the end user.
“open popup_1” and “open popup_2” being buttons aka “leaf widget” their id is computed but never stored as part of a stack.
For historical reasons and simplicity IDStack[] is story inside each window but it would be possible to use a shared IDstack[] stack for all windows, as long as Begin() appends to it that’s work (see the difference between PushID() and PushIDOverride() which ignore the current back of the back).
Version/Branch of Dear ImGui:
Version 1.9, Branch: master
Back-ends:
imgui_win32_opengl3
Compiler, OS:
Windows 10
Full config/build information:
No response
Details:
I'm struggling understanding how Dear ImGui stacks work and still have some problems although I've read the link about it on FAQ. You can see the example code in the code section. My thoughts:
stack_0
) containing:"open popup_1"
is clicked, a new stack (let's call itstack_1
) is made for"popup_1"
with that ID at the top and the popup is run/displayed."open popup_2"
is clicked, a new stack (let's call itstack_2
) is made for"popup_2"
with that ID at the top and since we're runningf()
, the second popup is also run/displayed.Which of my thought are right please?
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code: