Skip to content
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

List with multiple widgets as items. #1431

Open
kohlten opened this issue Aug 18, 2021 · 0 comments
Open

List with multiple widgets as items. #1431

kohlten opened this issue Aug 18, 2021 · 0 comments

Comments

@kohlten
Copy link

kohlten commented Aug 18, 2021

Hello,

I'm currently looking for a way to have a List store multiple widgets on each item of the list. A simple example would be a piece of text and a button. Is this possible with conrod?

I'm having an issue when you instantiate the List widget, you "set" to one node. If this node could have children, how would you access the Id to set the parent?

Here's a simple example of what I'm trying.

let values = vec![0, 1, 2, 3];
let (mut items, scrollbar) = widget::List::flow_down(items.len())
    .item_size(10.0)
    .scrollbar_on_top()
    .set(ids.list_id, ui);

while let Some(item) = items.next(ui) {
    let canvas = widget::Canvas::new();
    item.set(canvas, ui);
    widget::Text::new(&format!("{}", values[item.i]))
        .parent(<INSERT CANVAS ID HERE>);
    widget::Text::new(&format!("{:X}", values[item.i]))
        .parent(<INSERT CANVAS ID HERE>);
}

Any help would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant