Skip to content

List with multiple widgets as items. #1431

@kohlten

Description

@kohlten

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions