[][src]Module imgui_ext::nested

nested(...) docs (used to build nested UIs).

Types that #[derive(Ui)] can be nested.

Optional fields

  • catch

Example

#[derive(imgui_ext::Gui)]
struct Form {
    #[imgui(input)]
    user: imgui::ImString,
    #[imgui(
        input(flags = "passwd_flags"),
        button(label = "Login", catch = "login_btn")
    )]
    passwd: imgui::ImString,
}

fn passwd_flags() -> imgui::ImGuiInputTextFlags {
    imgui::ImGuiInputTextFlags::Password
}

#[derive(imgui_ext::Gui)]
struct Example {
    #[imgui(nested, separator)]
    login_form: Form,
    #[imgui(checkbox(label = "Remember login?"))]
    remember: bool,
}

Result

]result

Nested input events

You can access input events from nested UIs:

This example is not tested
// initialize imgui (ui) ...

let mut example = Example { ... };
let events: Events<Example> = ui.imgui_ext(&mut example);

if events.login_form().login_btn() {
    validate_user(
        &example.login_form.user,
        &example.login_form.passwd,
    )
}