-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Milestone
Description
Bug
egui_table_bug.mp4
Repro
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
use eframe::egui;
use eframe::egui::ScrollArea;
fn main() -> Result<(), eframe::Error> {
env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`).
let options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default().with_inner_size([320.0, 240.0]),
..Default::default()
};
eframe::run_native(
"My egui App",
options,
Box::new(|cc| {
// This gives us image support:
egui_extras::install_image_loaders(&cc.egui_ctx);
Box::<MyApp>::default()
}),
)
}
#[derive(Default)]
struct MyApp;
impl eframe::App for MyApp {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
ScrollArea::both().show(ui, |ui| {
egui_extras::TableBuilder::new(ui)
.auto_shrink([false, true])
.vscroll(false)
.columns(egui_extras::Column::exact(50.0), 2)
.header(18.0, |mut header| {
header.col(|ui| {
ui.label("Col1");
});
header.col(|ui| {
ui.label("col2");
});
})
.body(|body| {
body.rows(18.0, 100, |idx, mut row| {
row.col(|ui| {
ui.label(format!("R{}C1", idx));
});
row.col(|ui| {
ui.label(format!("R{}C2", idx));
});
});
});
});
});
}
}