New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested structs cause an error, internal sizing issues, but this thing is amazing! #1
Comments
Hi |
😸 You are great at this! |
I suppose to support more things would require functions to show them. For instance, to actually implement nested things, opening a "sub-window" would be the way to actually do it in a program interface. But that would mean creating a container group, with all of them sub groups (like tabs) but replacing the entire visible group with a different group. |
That would be difficult. I've added an implementation for vectors, which should work for any Vec where T implements FltkForm. The problem remains (like with tuple like structs and structs with unnamed fields), there is no way to fetch back the choices since vectors don't have named fields. I've added more examples of those. |
Well you've covered every normal sue case I can think of right off the bat. All in all I think for most people looking to make a really fast GUI for most reasonable use cases can basically build a struct, use serde and fltk-form. I know my edge case (in-game configuration) is small, but for anyone needing a custom struct to GUI this will be the easiest, smallest solution. It could be used as the primary UI on an embedded system, right? |
A possible solution for:
Would be to just display the Debug of |
I started using packs instead of Flex widgets, this should fix the issues with vecs. Setting and getting the choice value requires integral indices, which data-carrying enums can't be cast/converted into. |
@MoAlyousef That works great! The only issue arises when I have a lot of things. Things are cut off. The Scroll Box would fix those and any other issues with internal width/height display and would offer the best UX, I think. It does not display scrollbars if you do not need it, but if the window is too small everything fits. I used this as a base widget for most of my old C++ app windows. It fixed issues on old displays/small screens. |
@MoAlyousef Yeah this works perfectly now, it might be better to make the example have: //..
let mut grp = group::Scroll::default()//....
//.. I am closing the issue! Thanks! |
@MoAlyousef Question about the fltk::group::ScrollType. |
You can use set_type() or with_type(). let scroll = fltk::group::Scroll::default().with_type(fltk::group::ScrollType::BothAlways); |
That might be a good default for the example code for fltk-form, so all things will work in the most expected way when copy + paste coders code it aka things in the future like copilot : let mut grp = group::Scroll::default()
.with_size(300, 200)
.with_type(fltk::group::ScrollType::BothAlways)
.center_of_parent(); I did see the |
A struct within a struct causes a crash and backtrace is required to decipher nested structs do not work.
That said, nested enums, etc... work
The other issue is internal sizing, as you mentioned:
I think scaling the size of label is more important than the 'input', and unless something changed in FLTK you need to calculate text width by yourself. I've done it in the past based on the font size, but did not find the best solution.
All in all this is great!!! What an easy way to make a GUI for entering info!!! I can now build a GUI prefilled with values and switch between files with hardly any coding! This is so amazing!!
To sub nest a struct, the only possible way i can think is to return an Fl_Tab, with a
Group
for each extra struct as a tab.If every internal struct became a tab, it could potentially create a ton of tabs, and tabs within Tabs. But AFAIK this should nest correctly and look okay.
This has me wanting to get into macros, you are really good at this stuff!! Thanks so much!
The text was updated successfully, but these errors were encountered: