ptth/prototypes/ptth_quic_client_gui/src/main.rs

40 lines
750 B
Rust
Raw Normal View History

2021-10-10 21:55:51 +00:00
use fltk::prelude::*;
use fltk::group::Flex;
2021-07-19 01:56:42 +00:00
2021-10-10 21:55:51 +00:00
fn main () {
let _wind = fltk::window::Window::default ().with_size (800, 600);
2021-07-19 00:01:46 +00:00
let mut col = Flex::default ().column ().size_of_parent ();
2021-07-19 00:01:46 +00:00
2021-10-10 21:55:51 +00:00
// If I set `workaround` to true so that the column contains a single
// non-sized element, then I can add 100 rows with no problem.
// Otherwise it crashes at 11.
2021-07-19 00:01:46 +00:00
2021-10-10 21:55:51 +00:00
let workaround = true;
if workaround {
let row = Flex::default ().row ();
row.end ();
2021-07-19 00:01:46 +00:00
2021-10-10 21:55:51 +00:00
col.add (&row);
2021-07-19 00:01:46 +00:00
}
2021-10-10 21:55:51 +00:00
// 11 will trigger the floating-point exception, 10 will not
2021-10-10 21:55:51 +00:00
let count = if workaround {
100
2021-07-19 00:01:46 +00:00
}
else {
2021-10-10 21:55:51 +00:00
11
};
for _ in 0..count {
let mut row = Flex::default ().row ();
row.end ();
2021-10-10 21:55:51 +00:00
col.add (&row);
col.set_size (&mut row, 30);
}
2021-10-10 21:55:51 +00:00
col.recalc ();
}