styled/
styled.rs

1use fltk::{
2    app,
3    enums::*,
4    prelude::{GroupExt, WidgetExt},
5    window,
6};
7use fltk_table::{SmartTable, TableOpts};
8
9fn main() {
10    let app = app::App::default().with_scheme(app::Scheme::Gtk);
11    let mut wind = window::Window::default().with_size(800, 600);
12
13    let mut table = SmartTable::default()
14        .with_size(790, 590)
15        .center_of_parent()
16        .with_opts(TableOpts {
17            rows: 30,
18            cols: 15,
19            cell_selection_color: Color::Red.inactive(),
20            header_frame: FrameType::FlatBox,
21            header_color: Color::BackGround.lighter(),
22            cell_border_color: Color::White,
23            ..Default::default()
24        });
25
26    wind.end();
27    wind.show();
28
29    // Just filling the vec with some values
30    for i in 0..30 {
31        for j in 0..15 {
32            table.set_cell_value(i, j, &(i + j).to_string());
33        }
34    }
35    table.redraw();
36
37    // To avoid closing the window on hitting the escape key
38    wind.set_callback(move |_| {
39        if app::event() == Event::Close {
40            app.quit();
41        }
42    });
43
44    app.run().unwrap();
45}