You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried running the ListView example but ran into errors.
Is it possible to create a very simple demo where developers could essentially copy and past a ListView example to see a working demo? Or perhaps could I get some assistance in running the demo?
I am currently adding a gui to a simple search project I wrote. As far as I can tell, I cannot create a dynamic set of widgets unless I use the ListView - is this correct?
I like this project and like where its going. Amazing job to all involved.
The text was updated successfully, but these errors were encountered:
Try to summarize the needed blocks ... (which should go into orbtk-book
In general we try to implement reference code inside the example subdirectory of the orbtk crate. In concrete, the showcase code is designed to implement all common components, structured to group related widgets inside dedicated tabs.
You can find a reference section consuming the ListView widget around line 338.
The macro instantiates an ItemsView widget (which is used to represent a ListView. It defines a variable items consuming a List type. The List is constructed via a regular rust Vector creation macro [vec!], where its members are constructed from the given strings.
You are completely free, to construct your List/vector from a file io or socket/stream call.
// Represents an overview of list widgets like ListView, ItemsWidget and ComboBox.
widget!(ItemsView {
/// Active seleced index of combo box.
selected_index: i32,
/// Valid list of items.
items: List
});
impl Template for ItemsView {
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
let items = vec![
"Item 1".to_string(),
"Item 2".to_string(),
"Item 3".to_string(),
"Item 4".to_string(),
"Item 5".to_string(),
];
let items_count = items.len();
given Codeline 401 a ListView widget will consume the items_builder method, which itself is using a closure to iterate its index.
BuildContext is mutable and will assign the text variable, that will take the context of the vector string, that is addressed via its index position. Each text-index is rendered inside a TextBlock, aligned in the center of that widget.
Finally calling the build method will trigger the rendering pipeline. Compare to orbtk-book Ingredients, that visualizes the state workflow.
I tried running the ListView example but ran into errors.
Is it possible to create a very simple demo where developers could essentially copy and past a ListView example to see a working demo? Or perhaps could I get some assistance in running the demo?
I am currently adding a gui to a simple search project I wrote. As far as I can tell, I cannot create a dynamic set of widgets unless I use the ListView - is this correct?
I like this project and like where its going. Amazing job to all involved.
The text was updated successfully, but these errors were encountered: