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

Add on_release message to Slider #378

Merged
merged 5 commits into from
Jun 8, 2020
Merged

Conversation

Masterchef365
Copy link
Contributor

Sometimes, it's useful to have a message fire only when the user has finished changing a parameter. Other widgets like text inputs may also benefit from this functionality, and I'd be happy to implement those as well!

Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

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

Thanks!

I think this may be a nice addition. Do you have any specific use cases in mind for this?

native/src/widget/slider.rs Outdated Show resolved Hide resolved
native/src/widget/slider.rs Outdated Show resolved Hide resolved
native/src/widget/slider.rs Outdated Show resolved Hide resolved
@Masterchef365 Masterchef365 changed the title Add on_finish callback to Slider Add on_release message to Slider Jun 3, 2020
@Masterchef365
Copy link
Contributor Author

Incorporated the changes you suggested into it; had to make the message impl Clone but I assume that's not a big deal since Button requires it too. Added a bit of an explanation for the on_release message as well; the use case I have is that a long running task (actually a whole thread) is spawned to perform an update to a large amount of data every time the slider is changed. on_change would fire that event every time a mouse position update was detected, and the result was that my app suddenly used 100% of all cores every time the slider was moved. I could've solved this by limiting when the thread could be spawned, but that wasn't exactly the behavior I wanted.

native/src/widget/slider.rs Show resolved Hide resolved
@hecrj hecrj added the feature New feature or request label Jun 4, 2020
@hecrj hecrj added this to the 0.2.0 milestone Jun 4, 2020
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

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

Great! Thank you 🎉

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

Successfully merging this pull request may close these issues.

2 participants