Skip to content
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

Debug "BeginPopupContextItem" & "OpenPopup" #452

Closed
ghost opened this issue Dec 24, 2015 · 1 comment
Closed

Debug "BeginPopupContextItem" & "OpenPopup" #452

ghost opened this issue Dec 24, 2015 · 1 comment
Labels

Comments

@ghost
Copy link

ghost commented Dec 24, 2015

Hi,

I have a problem with "BeginPopupContextItem", the context menu does not appear.

So, I have try to debug, but I'm not sure to understand exactly what is happening.

Here is the code of the OpenPopup :

void ImGui::OpenPopup(const char* str_id)
{
    ImGuiState& g = *GImGui;
    ImGuiWindow* window = g.CurrentWindow;
    ImGuiID id = window->GetID(str_id);
    int current_stack_size = g.CurrentPopupStack.Size;
    ImGuiPopupRef popup_ref = ImGuiPopupRef(id, window, window->GetID("##menus"), g.IO.MousePos); // Tagged as new ref because constructor sets Window to NULL (we are passing the ParentWindow info here)
    if (g.OpenedPopupStack.Size < current_stack_size + 1)
        g.OpenedPopupStack.push_back(popup_ref);
    else if (g.OpenedPopupStack[current_stack_size].PopupID != id)
    {
        g.OpenedPopupStack.resize(current_stack_size+1);
        g.OpenedPopupStack[current_stack_size] = popup_ref;
    }
}

At the end, you notice that the last block simply "close" the current popup... it is my problem !
Where :
"OpenedPopupStack" size = 1
"current_stack_size" = 0

Do you know how I can track the problem ? Is there another popup opened somewhere ?

@ocornut
Copy link
Owner

ocornut commented Dec 24, 2015

Missing repro / explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant