Skip to content

context menu on node content #40

Description

@sphaero

Imagine I want to add a context menu on node content. In the sample.cpp:

                // Custom node content may go here
                ImGui::Text("Content of %s", node->Title);
                const char* names[5] = { "Label1", "Label2", "Label3", "Label4", "Label5" };
                for (int n = 0; n < 5; n++)
                {
                    ImGui::Selectable(names[n]);
                    if (ImGui::BeginPopupContextItem()) // <-- use last item id as popup id
                    {
                        ImGui::Text("This a popup for \"%s\"!", names[n]);
                        if (ImGui::Button("Close"))
                            ImGui::CloseCurrentPopup();
                        ImGui::EndPopup();
                    }
                    if (ImGui::IsItemHovered())
                        ImGui::SetTooltip("Right-click to open popup");
                }

This is just pasted from imgui_demo.cpp

This doesn't work. Only the context menu for adding nodes is opened.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions