widget_table/
widget_table.rs

1// This shows usage of the TableExt::find_cell() method to populate a table with widgets, like a GroupExt widget
2
3use fltk::{prelude::*, *};
4
5fn main() {
6    let a = app::App::default();
7    let mut win = window::Window::default().with_size(500, 400);
8    let mut table = table::Table::default()
9        .with_size(400, 130)
10        .center_of_parent();
11    table.set_frame(enums::FrameType::NoBox);
12    table.set_scrollbar_size(-1);
13    table.set_rows(5);
14    table.set_cols(5);
15    for i in 0..5 {
16        for j in 0..5 {
17            if let Some((x, y, w, h)) = table.find_cell(table::TableContext::Cell, i, j) {
18                button::Button::new(x, y, w, h, None).with_label(&(i + j).to_string());
19            }
20        }
21    }
22    table.end();
23    win.end();
24    win.show();
25    a.run().unwrap();
26}