[][src]Module imgui_ext::button

button(...) docs.

button(...) is not associated to any particular type, but its position within an annotation will determine where it is rendered in the final UI.

Fields

  • label

Optional fields

  • size name of a local function that returns the button size.
  • catch

Example

This example is not tested
#[derive(ImGuiExt)]
struct Buttons {
    #[imgui(
        button(size = "button_size", label = "Click me!", catch = "click"),
        separator,
        display(label = "Clicks"),
    )]
    count: i32,
}

const fn button_size() -> (f32, f32) {
    (100.0, 20.0)
}

// initialize ui and Buttons...
let events = ui.imgui_ext(&mut buttons);
if events.click {
    buttons.count += 1;
}