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

Using the Grid widget like a complete table. #90

Closed
Kuraga13 opened this issue Feb 18, 2023 · 3 comments
Closed

Using the Grid widget like a complete table. #90

Kuraga13 opened this issue Feb 18, 2023 · 3 comments

Comments

@Kuraga13
Copy link

Kuraga13 commented Feb 18, 2023

I'm trying to make something like a Hex Viewer using a Grid Widget.

Apparently, this only works with a small number of lines, since the window just freezes. Is there any way to make a table?
The table was also requested here [(https://github.com/iced-rs/iced/discussions/1234)]

I'm a beginner, I apologize if the question seems naive.

     let mut grid = Grid::with_columns(3)
    .push(Text::new("").style(theme::Text::Color(Color::from([0.05882, 0.72157, 0.10196]))))
    .push(Text::new("01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F").style(theme::Text::Color(Color::from([0.05882, 0.72157, 0.10196]))))
    .push(Text::new("ASCII").style(theme::Text::Color(Color::from([0.05882, 0.72157, 0.10196]))));


    let mut rows_amount = (buff.end_addr - buff.start_addr) / buff.lenght_;

    let hex_index = usize::from(rows_amount);
    dbg!(hex_index);


    for i in 0..hex_index {
    grid.insert(Text::new(format!("Row {}, Test", (1))));
    grid.insert(Text::new(format!("Row {}, Test", (2))));
    grid.insert(Text::new(format!("Row {}, Test", (3))));

    let  final_buff = Column::new()
    .spacing(15)
    .max_width(600)
    .padding(10)
    .width(Length::Fill)
    .align_items(Alignment::Center)
    .push(grid)
    .into();
    
    let page_buff_scroll = Scrollable::new(final_buff);

    final_buff
@genusistimelord
Copy link
Collaborator

tbh IDK why it freezes with a lot of lines. This could just be one of the random rendering issues with how iced works too. Since it renders everything even within the scrollbar and just removes them based upon bounds and such. I will also wait to look into this more since Iced will get a huge graphics update soon. which might fix a lot of issues we currently have.

@Kuraga13
Copy link
Author

Thank you. Ok, this is much deeper. Then I'll write to iced. The table is a must have, for any gui.

@Kuraga13
Copy link
Author

Solvered here
iced-rs/iced#1720

@Kuraga13 Kuraga13 reopened this Feb 22, 2023
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

2 participants