-
Notifications
You must be signed in to change notification settings - Fork 16
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
base: main
Are you sure you want to change the base?
Feature/add mouse events #20
Conversation
@@ -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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 theInput.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
This is for highlight ranges, I use it to show which repo's are private (green):
![highlight_ranges](https://private-user-images.githubusercontent.com/22514713/266843351-2585007b-45a8-4549-9d34-6e8ebd5b3ef8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzODQyMjgsIm5iZiI6MTczOTM4MzkyOCwicGF0aCI6Ii8yMjUxNDcxMy8yNjY4NDMzNTEtMjU4NTAwN2ItNDVhOC00NTQ5LTlkMzQtNmU4ZWJkNWIzZWY4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDE4MTIwOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJhZGMwY2E3ZTdhODQwYTE4MTNhOTYzNTY2YzFiMDVjM2U3NzdkNDA1ODA3N2Y0YmRlZGFkNjRiMGM3MGViMDMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.fVA8vAF8IzbA55aGYfoM84ouQlEzbuQjDZ1PV5tKuX4)
Cheers
Thanks for doing this @MorningLightMountain713 - using it in my projects now |
I noticed you’re actively working on this branch, and I was wondering if you could help with this issue: The Thanks in advance! |
Allows the dropdown to be hovered / selected with the mouse