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

feat: double-click handlers for items #2005

Merged
merged 1 commit into from
Jan 12, 2023

Conversation

v-ein
Copy link
Contributor

@v-ein v-ein commented Jan 6, 2023


name: Pull Request
about: Create a pull request to help us improve
title: Allow double_click_handler to be bound to items
assignees: @hoffstadt


Closes #1534

Description:
Added a double-click handler for items, modeled after the regular click handler, but with appropriate click flags being pulled from ImGui.

Concerning Areas:
None.

@Pcothren
Copy link
Collaborator

Pcothren commented Jan 11, 2023

Verified working on windows by replacing demo.py

DearPyGui/dearpygui/demo.py

Lines 2647 to 2651 in 334a216

with dpg.item_handler_registry(tag="demoitemregistry"):
dpg.add_item_clicked_handler(0, callback=lambda s, a, u: print(f"clicked_handler: {s} '\t' {a} '\t' {u}"))
dpg.add_item_clicked_handler(1, callback=lambda s, a, u: print(f"clicked_handler: {s} '\t' {a} '\t' {u}"))
dpg.add_item_hover_handler(callback=lambda s, a, u: print(f"hover_handler: {s} '\t' {a} '\t' {u}"))
dpg.bind_item_handler_registry(cb, "demoitemregistry")

with

                with dpg.item_handler_registry(tag="demoitemregistry"):
                    dpg.add_item_clicked_handler(0, callback=lambda s, a, u: print(f"clicked_handler: {s} '\t' {a} '\t' {u}"))
                    dpg.add_item_clicked_handler(1, callback=lambda s, a, u: print(f"clicked_handler: {s} '\t' {a} '\t' {u}"))
                    dpg.add_item_hover_handler(callback=lambda s, a, u: print(f"hover_handler: {s} '\t' {a} '\t' {u}"))
                    dpg.add_item_double_clicked_handler(callback=lambda s, a, u: print(f"double_clicked_handler: {s} '\t' {a} '\t' {u}"))

Thanks for the fix!

@hoffstadt hoffstadt merged commit ea2c43b into hoffstadt:master Jan 12, 2023
@v-ein v-ein deleted the feature/1534-double-click-handler branch June 23, 2023 07:44
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.

allow double_click_handler to be bound to items
3 participants