gyscos / gyscos/cursive

Modal dialog support

Open
#293 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4.8k
Forks
270
Avg merge
5d 19h
Merged PRs (30d)
2

Description

I've had an issue that my dialog, which is meant to be modal, can lose control of the events stream when global event handling picks up an event they the dialog does not (e.g. ESC to open the menu bar). To make it properly modal, I think only it should receive events until it is closed.

https://www.reddit.com/r/rust/comments/8bgq2r/someoneshould_rust_community_whats_your/ suggests that this is a known problem, but I've seen no card for it, nor any solution documented.

How about allowing a dialog to be marked as modal, where this results in no events being passed to the menus or the global handling until the dialog is closed?

```
siv.add_layer(
// Most views can be configured in a chainable way
Dialog::around(TextView::new("Hello Dialog!"))
.title("Cursive")
.modal()
.button("Quit", |s| s.quit())
.button("Cancel", |s| s.pop_layer()),
);
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.