-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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
Modal window flag request #402
Comments
I'm not sure I understand the issue nor the request very precisely. It is is the later I would be more inclined to discuss those issues in more details and find a solution. I'm pretty sure there are issues with the current scheme as I myself as a user had to sometimes juggle with the id stack and where I am user popups. I haven't yet taken the problem apart to figure out a correct solution and more than happy to hear in detail about your use case. FYI the reason I had to initially make the opened/close state of popups stored within ImGui is that it needs to be able to close them without user intervention/code and therefore it needs access to those booleans. Calling OpenPopup() very frame is definitively incorrect and probably leading to other subtle problems. |
Note that even thou ImGuiWindowFlags_Modal is described as "private, don't use!" it is pretty much public and you could probably devise an improved popup patterns using a copy of the BeginPopupModal() code as a base, however I'm very much interesting in hearing about your suggestion and findings on how to make popup usage better. |
Apologies for not being clear. I would like to be able to create a modal window without using the BeginPopupModal() method. I did try using the ImGuiWindowFlags_Modal flag, which didn't work. I will take a look into the popup code to see what else is needed to replicate this functionality. |
Then my comment above stands - even though it is fine to bypass that mechanism I would like to know why exactly and how we can fix/improve it, rather than people just bypassing it. |
My problem is due to not quite using the imgui approach for displaying windows, but instead I have windows which add themselves to a list to be rendered. With the exception of modal dialogues this works really well using your ImGui (many thanks :) ). So the render function for a modal popup currently looks something like this:
Note that this function only gets called if I want the dialogue to be shown. The dialogue gets added to the list outside the render loop, and potentially by another thread so the OpenPopup() can't easily be called there. Does this help enough in understanding the problem? I'm happy using the above approach so this isn't an urgent or essential feature request. |
So what's the problem with using the code above? (Sorry if I am missing something obvious) |
There are two problems that I can see, neither of which are major:
|
So
|
Currently the window flags specify that Modal is an internal flag only able to be set by a popup using BeginPopupModal and thus using OpenPopup().
Since OpenPopup() requires both the stack and the str_id/name of the popup re-using a function which draws the popup becomes a bit more of a pain to manage than it should be (since you need to repeat code or manage state of the popup), or call OpenPopup() every frame.
A usable modal window flag would solve this problem for me.
This is likely related to issue #331 and perhaps comments from @Flix01 in issue #88 about needing to call OpenPopup() every frame.
The text was updated successfully, but these errors were encountered: