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 Ui::close and Response::should_close #5729

Merged
merged 7 commits into from
Feb 20, 2025
Merged

Add Ui::close and Response::should_close #5729

merged 7 commits into from
Feb 20, 2025

Conversation

lucasmerlin
Copy link
Collaborator

@lucasmerlin lucasmerlin commented Feb 19, 2025

This adds a generic way of telling containers to close from their child Uis.

Copy link

Preview available at https://egui-pr-preview.github.io/pr/5729-lucasui-close
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@lucasmerlin lucasmerlin added feature New feature or request egui labels Feb 19, 2025
Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

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

Really nice!

Comment on lines 637 to 642
// TODO(lucas): I feel stupid, is there some better way to pass the &mut open
// without moving it?
match &mut open {
None => None,
Some(open) => Some(open),
},
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
// TODO(lucas): I feel stupid, is there some better way to pass the &mut open
// without moving it?
match &mut open {
None => None,
Some(open) => Some(open),
},
open.as_mut(),

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

With this I get a Option<&mut &mut bool>. But turns out open.as_deref_mut() works! Not very intuitive 😅

@lucasmerlin lucasmerlin merged commit f5b058b into master Feb 20, 2025
46 checks passed
@lucasmerlin lucasmerlin deleted the lucas/ui-close branch February 20, 2025 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
egui feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants