Add Ui::close and Response::should_close#5729
Merged
lucasmerlin merged 7 commits intomasterfrom Feb 20, 2025
Merged
Conversation
|
Preview available at https://egui-pr-preview.github.io/pr/5729-lucasui-close |
814cf53 to
51cf5e8
Compare
emilk
approved these changes
Feb 20, 2025
crates/egui/src/containers/window.rs
Outdated
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), | ||
| }, |
Owner
There was a problem hiding this comment.
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(), |
Collaborator
Author
There was a problem hiding this comment.
With this I get a Option<&mut &mut bool>. But turns out open.as_deref_mut() works! Not very intuitive 😅
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
darkwater
pushed a commit
to darkwater/egui
that referenced
this pull request
Aug 24, 2025
This adds a generic way of telling containers to close from their child `Ui`s. * Part of emilk#5727 * [x] I have followed the instructions in the PR template --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a generic way of telling containers to close from their child
Uis.Response::closedand investigate generalizingpopup::OpenKindas something that could be used withWindow,Collapsing,Areaetc... #5727