多窗口显示
效果图
依赖
orbtk = "0.3.1-alpha3"
serde_derive = "1.0.106"
代码
/// mutli window will not work properly on web now. But it will be fixed.
use orbtk::prelude::*;
#[derive(AsAny, Default)]
struct MainState {
show_window: bool,
}
impl MainState {
fn show_window(&mut self) {
self.show_window = true;
}
}
impl State for MainState {
fn update(&mut self, _: &mut Registry, ctx: &mut Context) {
if self.show_window {
button(ctx.child("button")).set_enabled(false);
ctx.show_window(|ctx| {
Window::new()