Skip to content

[QUESTION] Why can there only be one Popup at a time? #842

@sleeptightAnsiC

Description

@sleeptightAnsiC

I believe, this was already indirectly mentioned in several other issues. Examples:

There are multiple places in the library where, if you attempt to spawn another Popup, it will either trigger an assert or silently fail and do nothing. Examples:

panel = win->layout;
NK_ASSERT(!((int)panel->type & (int)NK_PANEL_SET_POPUP) && "popups are not allowed to have popups");
(void)panel;

/* make sure that no nonblocking popup is currently active */
win = ctx->current;
in = &ctx->input;
if (win->popup.win && ((int)win->popup.type & (int)NK_PANEL_SET_NONBLOCK))
return 0;

This is quite annoying because few widgets use Popups under the hood (e.g. Menus) and so this limitation is not always clear.
Right now, it prevents creation of nested context menus, "cascading menus", stacked modals, and so on... For comparison, DearImGui does not have this problem.

Is there a specific reason why this limitation exists?
Are Popups implemented in a way, where supporting multiple of them would be a problem?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions