Giving this UI (src/ui.fl)
# data file for the Fltk User Interface Designer (fluid)
version 1.0308
header_name {.h}
code_name {.cxx}
class UserInterface {open
} {
Function {make_window()} {open
} {
Fl_Window {} {open
xywh {738 160 231 220} type Double visible
} {
Fl_Button but {
label {Click me}
xywh {66 67 95 45}
}
Fl_Menu_Bar {} {open
xywh {0 0 230 22}
} {
MenuItem m_menu {
label {Select me} selected
xywh {0 0 100 20}
}
}
}
}
}
When I try to used in src/main.rs:
use fltk::{prelude::*, *};
mod ui {
fl2rust_macro::include_ui!("src/ui.fl");
}
fn main() {
let a = app::App::default();
let mut ui = ui::UserInterface::make_window();
// this won't compile
// error[E0609]: no field `m_menu` on type `UserInterface`
// ui.m_menu.set_callback(|_b| println!("Menu clicked!"));
ui.but.set_callback(|_b| println!("Button clicked!"));
a.run().unwrap();
}
The Cargo.toml used was:
name = "bug_fl2rust"
version = "0.1.0"
edition = "2024"
[dependencies]
fl2rust-macro = "0.7.0"
fltk = "1.5.9"
Giving this UI (src/ui.fl)
When I try to used in src/main.rs:
The Cargo.toml used was: