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

Internals: ComboBox add additional ButtonFlags parameter #7569

Closed
wants to merge 2 commits into from

Conversation

xevgeny
Copy link

@xevgeny xevgeny commented May 9, 2024

This change allows customization of button behavior for the ComboBox widget.

The default behavior for many buttons is to react on click + release. Now, it's possible to specify the behavior.

static ImGuiComboFlags flags = 0;
static ImGuiButtonFlags button_flags = ImGuiButtonFlags_PressedOnClick;
if (ImGui::BeginCombo("combo 1", combo_preview_value, flags, button_flags))
{
  ...
}

In this example, the ComboBox reacts immediately to a mouse click event. This requires fewer frames to render the open popup window and also fixes issue #7544

Please note that we have to expose a set of Pressed flags to the user, which were previously internal:

  • ImGuiButtonFlags_PressedOnClick
  • ImGuiButtonFlags_PressedOnClickRelease
  • ImGuiButtonFlags_PressedOnClickReleaseAnywhere
  • ImGuiButtonFlags_PressedOnRelease
  • ImGuiButtonFlags_PressedOnDoubleClick
  • ImGuiButtonFlags_PressedOnDragDropHold

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

Successfully merging this pull request may close these issues.

None yet

1 participant