How to set position and size of a Popup Modal #676

Closed
opened 2016-05-29 11:41:25 +00:00 by Flix01 · 4 comments
Flix01 commented 2016-05-29 11:41:25 +00:00 (Migrated from github.com)

Hi.

I'm trying to set the window position and size of a popup modal window.
I've tried with:

    if (ImGui::BeginPopupModal(...)) {
        ImGui::SetWindowPos(wndPos);
        ImGui::SetWindowSize(wndSize);
        ...
        ImGui::EndPopup();
    }

but it doesn't seem to work...

Actually it seems that the window is always centered... am I missing some flag ?

Hi. I'm trying to set the window position and size of a popup modal window. I've tried with: ``` c++ if (ImGui::BeginPopupModal(...)) { ImGui::SetWindowPos(wndPos); ImGui::SetWindowSize(wndSize); ... ImGui::EndPopup(); } ``` but it doesn't seem to work... Actually it seems that the window is always centered... am I missing some flag ?
ocornut commented 2016-05-29 11:44:03 +00:00 (Migrated from github.com)
Always use SetNextWindowPos,
  SetNextWindowSize()
  SetWindowPos/SetWindowSize may be removed.
``` Always use SetNextWindowPos, SetNextWindowSize() SetWindowPos/SetWindowSize may be removed. ```
Flix01 commented 2016-05-29 11:52:34 +00:00 (Migrated from github.com)

Thanks!

Thanks!
ocornut commented 2016-05-29 11:56:34 +00:00 (Migrated from github.com)

Does it actually fix your issue?

Does it actually fix your issue?
Flix01 commented 2016-05-29 12:32:09 +00:00 (Migrated from github.com)

Yes! Although I had also one frame delay before SetNextWindowPos was actually applied.
Not sure if that is something dealing with my specific (very complex) code...

Basically I had to call SetNextWindowPos(...) at the frame after the one in which I called for the first time ImGui::OpenPopup() and ImGui::BeginPopupModal().

However this frame-lag issue was very easy to handle for me.

Yes! Although I had also one frame delay before SetNextWindowPos was actually applied. Not sure if that is something dealing with my specific (very complex) code... Basically I had to call SetNextWindowPos(...) at the frame after the one in which I called for the first time ImGui::OpenPopup() and ImGui::BeginPopupModal(). However this frame-lag issue was very easy to handle for me.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#676
No description provided.