-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Modal dialogs #686
Comments
This comment was marked as outdated.
This comment was marked as outdated.
Hmm... The settings window in the demo is not modal, it loses focus when you click another window. |
There is no modal windows in egui at the moment, but I suspect adding support for it would be pretty easy (just ignore interactions with the non-modal Area). I wonder if one should also darken the background when showing a modal window? |
Something like that would be nice, so the user can easily recognize that his attention is required. |
Definitely something that I'd be interested in having, as my current "project" would need to implement a sort of dialog boxes for data introduction! Thanks for hearing @sourcebox out, @emilk :) |
I would like to open a PR that might solve this. Can I? |
…w entity picker (#4577) ### What Since egui doesn't have support for modal windows yet (emilk/egui#686), we rolled our own for the Space View entity picker ("Add/remove entities"). This PR abstracts the modal creation code into a dedicated feature in `re_ui`, and use that abstraction for the space view entity picker. The new `re_ui::modal` has support for two aspects of modal window management: - The modal window itself (`re_ui::modal::Modal`), which handles dimming the background, a close button, and exiting with ESC and/or clicking outside of the window. - The handling of the modal window (`re_ui::modal::ModalHandler`). The `Modal` struct should be kept only while the modal is actually shown, so it's typically held in and `Option<Modal>`. `ModalHandler` implements the house keeping of populating the `Option` when the modal must be displayed, and dropping it when the modal is closed. **Note**: with this PR, the modals are now properly centred, although erroneous centring behaviour might happen that require deleting your `app.ron`. This will eventually be fixed with a new egui release that includes emilk/egui#3721 Usage: <img width="583" alt="image" src="https://github.com/rerun-io/rerun/assets/49431240/a079def4-f11a-4eeb-a3ec-6c777d078bdd"> <img width="443" alt="image" src="https://github.com/rerun-io/rerun/assets/49431240/13114dd4-3051-486c-9e4a-df4c783a0780"> ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using newly built examples: [app.rerun.io](https://app.rerun.io/pr/4577/index.html) * Using examples from latest `main` build: [app.rerun.io](https://app.rerun.io/pr/4577/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [app.rerun.io](https://app.rerun.io/pr/4577/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG - [PR Build Summary](https://build.rerun.io/pr/4577) - [Docs preview](https://rerun.io/preview/fb5add0047f108769c413393d65d52e362cbcc8e/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/fb5add0047f108769c413393d65d52e362cbcc8e/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html) --------- Co-authored-by: Andreas Reich <[email protected]>
A proper modal window should have the following properties: A) it should open on top of all existing windows This implies some sort of ordered stack of modal It should also be easy to configure how to dismiss a modal by e.g. pressing escape (should only escape the top-most modal!) or pressing anywhere on the background. |
Thank you for pointing that out. I'm currently using egui-file-dialog, which supports being modal, and also displaying a custom right panel. I want to add a button to the right panel to select an optional "metafile" to use for the selected file (a feature of my hex editor), which would open up another modal file dialog to select the metafile. |
I had a look into the various areas of the demo and could not find anything. Is it already possible to use modal dialogs, e.g. for errors, user confirmation or an "about box" with credits?
The text was updated successfully, but these errors were encountered: