fltk-rs / fl2rust

A fluid (fltk ui designer) file to Rust transpiler
MIT License
53 stars 3 forks source link

Generated code mismatches types on value_outputs #5

Closed MoKe12g closed 3 years ago

MoKe12g commented 3 years ago

I'm trying to set the (start-) value of a value_output to a specific number. FL Code: Fl_Value_Output rom9d { xywh {15 375 28 25} value 9 } Rust Code: let mut rom9d = ValueOutput::new(15, 375, 28, 25, None); rom9d.set_value("9"); fl2rust_widget_3.add(&rom9d); Rust compiler complains: Mismatched types: expected "f64", found "&str" The generated code tries to set the value of this value_output as &str but it only accepts f64.

Could you please implement a check for these value in- / outputs to remove the quotation marks? Or something like a basic type check to pass the value as f64 or &str.

Setting a value as maximum value works great through. fl2rust_widget_93.set_maximum(15 as _);

MoAlyousef commented 3 years ago

Hi I've published a new version (0.4.7) with a fix.

MoKe12g commented 3 years ago

Thanks for the fast fix. It now builds without any complains.