Skip to content

Can I generate button elements at runtime? #795

Answered by 13r0ck
randall-coding asked this question in Q&A
Discussion options

You must be logged in to vote

No no quick fix, unfortunately you attempt is completely wrong :)
You need to iter_mut() though the vec of button::States. Basically no way to do it without the .fold
something like

let button_col = self.button_states.iter_mut().fold(Column::new() |col, btn| {
    col.push(
        Button::new(
            &mut btn,
            ~~ rest of button ~~
        )
    )
});

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by randall-coding
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #794 on March 26, 2021 06:31.