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

Feature/add mouse events #20

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

MorningLightMountain713

Allows the dropdown to be hovered / selected with the mouse

@@ -368,6 +366,12 @@ def close(self) -> None:
if self.display:
self.display = False

def on_mouse_move(self, event: events.MouseMove) -> None:
self.child.selected_index = event.y
Copy link
Owner

Choose a reason for hiding this comment

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

I suspect this will need to account for scrolling by adding on scroll_offset.y

Choose a reason for hiding this comment

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

Thanks, I'll check it out

Choose a reason for hiding this comment

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

I've tested this with both scroll on the dropdown and scroll on the page - unaffected by scroll_offset.

If it's okay - I have a few other changes I can push to another pull request once I've tidied them up.

  • allows styles to be passed in for highlight_ranges so you can group options in the dropdown. I use this to differentiate selections in the list.
  • some logic changes. Adds a DropdownSelected event instead of bubbling the Input.Selected on dropdown item select
  • I also have a preventable input that I find useful - can disable the user from being able to type (refreshes the cursor blink only) I use it in conjunction with autocomplete, (could also use it to limit input length etc) However that's more for textual I think. (not sure if others would find that useful)

Can also use this as a context manager:

with my_input.prevent_input():
    ...
    # do stuff here where the user can't type

Scroll on selection:
scroll_on_selection

Selection made:
selection_made

This is for highlight ranges, I use it to show which repo's are private (green):

highlight_ranges

Cheers

@charles-001
Copy link

Thanks for doing this @MorningLightMountain713 - using it in my projects now

@charles-001
Copy link

charles-001 commented Dec 13, 2024

Hi @MorningLightMountain713,

I noticed you’re actively working on this branch, and I was wondering if you could help with this issue: The AutoComplete popup doesn’t follow the cursor as expected after resizing—it remains fixed in its original position

Thanks in advance!

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.

3 participants