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

Added Filter to ComboWidget #950

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

theaino
Copy link
Contributor

@theaino theaino commented Mar 18, 2025

In examples/imguidemo, there is a combo box with a filter. It sadly doesn't seem to exist currently, creating quite a false-promise. So, I went to the original imgui repo and took the code from there to create a Filter method on the ComboWidget, specifying if there should be a TextFilter when opening it.

Widgets.go Outdated
filter.Clear()
}

filter.DrawV("##Filter", -1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might result in some strange behaviours when multiple things with this tag are drawn. Maybe use GenAutoID here.

@theaino theaino requested a review from gucio321 March 19, 2025 15:33
@@ -201,6 +205,9 @@ func Combo(label, previewValue string, items []string, selected *int32) *ComboWi
selected: selected,
flags: 0,
width: 0,
filter: false,
filterWidget: imgui.NewEmptyTextFilter(),
filterLabel: GenAutoID(""),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use GenAutoID("filter") (because of internal mechanisms of GenAutoID this will reduce potential issues)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this makes the popup just rapidly grow for some reason.

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.

2 participants