Factory for creating rows in a table #689
-
I would like to create a table based on a model that produces a row with multiple widgets, e.g. two labels, an entry, and a button. All widgets should be vertically aligned, producing a tabular format for the UI. Like a spreadsheet if you want, but I don't want visible cells. Perhaps the solution is just to use a If it is possible to use a grid as the parent, how do I position the individual widgets of each row given that the Would it not mean that the view must produce more than one element instead of a single root widget? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 16 replies
-
I think you can use |
Beta Was this translation helpful? Give feedback.
Mhh, we only progress from one problem to another. This is an particularly unpleasant problem in Rust and something I deal with rarely (which is why it took me so long to remember all the details).
I hope I've now considered all the potential problems. I think there are two possibilities:
thread_local
and then.with(|w| w.clone())
to access the widgets (since widgets can be cloned cheaply as they are smart pointers likeRc
)static
sync::LazyLock
with eitherMutex
orFragile
Both solutions are not ideal, but somehow you have to satisfy the constraints of the compiler.