[egui] Changing scene/stage

⚓ rust    📅 2025-05-16    👤 surdeus    👁️ 4      

surdeus

Warning

This post was published 45 days ago. The information described in this article may have changed.

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: [egui] Changing scene/stage

How to change one window content to another one?
I know I should use app state and somehow operate it (through match), but I don't get how to get ui content, for example how to replace central panel content and bottom panel panel at the same time after click on a button

I think it should be like that

enum AppState{
    ConfigureSchemeChoosing,
    ConfigureNaming,

struct App{
   app_state: AppState,
}
fn update(&mut self, ctx: &eframe::egui::Context, frame: &mut eframe::Frame) {
 egui::TopBottomPanel::bottom("footer")
      .show(ctx, |ux|{
           match AppState {
                ConfigureSchemeChoosing => {
                    ui.button("next")
                }
                ConfigureNaming => {
                    ui.button("previous")
                }
           }
      });
}

Moreover, I want elements to be in other rs files. One window = one file
}

1 post - 1 participant

Read full topic

🏷️ rust_feed