-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Permit to highlight selectable programmatically #7820
Conversation
Hello, I don't quite understand this. The The change of API is unfortunately unacceptable: bool already tend to be a major API issue, let alone bool with default values, let alone new signatures introducing new bools in the middle of existing bools. However, we could consider introducing new flags e.g. ImGuiSelectableFlags_SelectedUseHoveredColor, that would solve the problem with signature and facilitate this use case. |
Thank for the fast reply. Sorry, I had understood selected as in others GUI's semantic, not a way to simply highlight items. And using a new flag is way way more simple... my bad (twice). Do I close this PR and create a new one or can I recycle it for a whole new commit set? What about the first commit, do I keep it? best regards |
About your idea of a |
You are right, it might be a
In most cases until now _Selected doesn't have any other effect than drawing with this color. |
…light items independently from the hovered state
updated to use the proposed flag |
…ems independently from the hovered state. (#7820) Demo: Make the Widget/List boxes show how to use forced highlighting.
Thank you, merged as c7b9256 with minor changes ( |
Hello,
This PR aims to permit rendering a selectable item as it was hovered even if the mouse cursor is not over it. My own use is as follow:
It is done by adding a new parameter to
ImGui:::Selectable(const char*, bool, ...)
to control the highlighting and by making this function handles the hovered state as highlighted because the mouse cursor is over it. The 2 new overloaded functions are only there to avoid breaking the public API (or so I hope)Here is a video taken from the list boxes demo where the first list box triggers the highlighting in the second one:
highlighting-selectable.mp4
Any correction/feedback are welcome.
Best regards.
Edit: the video was not displayed...