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 flag for selectables to handle double clicks. #516

Merged
merged 1 commit into from
Mar 2, 2016
Merged

Added flag for selectables to handle double clicks. #516

merged 1 commit into from
Mar 2, 2016

Conversation

zapolnov
Copy link
Contributor

I am implementing a file tree with ImGui (like project viewer) and I needed a way to open file on double click. So I have added a flag for Selectables to handle double clicks.

I am not sure that this is the right way to do things. But it would be great if ImGui offered such a functionality. So I am sharing my solution.

BTW, thanks for the great library!

@itamago
Copy link

itamago commented Jan 31, 2016

I need it too. You saved my time, thx !!

@ocornut
Copy link
Owner

ocornut commented Feb 1, 2016

Thanks Nikolay, it looks good! I may shuffle/rename the enums a little.

@ocornut ocornut merged commit a908c10 into ocornut:master Mar 2, 2016
ocornut added a commit that referenced this pull request Mar 2, 2016
…leDoubleClick to ImGuiSelectableFlags_AllowDoubleClick + comments
@ocornut
Copy link
Owner

ocornut commented Mar 2, 2016

Merged.
I have to say this is among the closest-to-perfection PR I ever got here, so thank you! Even if the feature is relatively minor you added all the right stuff at the right place and this is remarkably rare :)

I have renamed ImGuiSelectableFlags_HandleDoubleClick to ImGuiSelectableFlags_AllowDoubleClick because Allow is a more commonly used term in the codebase and it more clearly denote the fact that normal clicks are also allowed.

I have also commented and reordered the ButtonFlags enum as they are internal flags so reshuffling them shouldn't be an issue (and if it becomes an issue to anyone I'm rather know about it). Some of those button flags aren't well named as they weren't designed for very-public use yet.

ocornut added a commit that referenced this pull request May 1, 2016
@ocornut
Copy link
Owner

ocornut commented May 1, 2016

FYI this PR had an issue as the new DoubleClick flag added to internal ButtonEx/ButtonBehavior would still allow simple click to pass. I fixed it and re-arranged Selectable() so that ImGuiSelectableFlags_AllowDoubleClick permit both.

With newly added TreeNodeEx() I think it may make more sense to use TreeNodeEx and Selected flag to do that sort of tree you were doing. Would be interesting if you want to look into that.

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

Successfully merging this pull request may close these issues.

3 participants