How Can i Create a Scrollable list of the Number's using the egui like in the image but 1 Column. #4903
Unanswered
SohamTilekar
asked this question in
Q&A
Replies: 2 comments 8 replies
-
I trid the Things From demo But it didn't work because the array length is 2^24 |
Beta Was this translation helpful? Give feedback.
0 replies
-
You mean something like this with the show_rows method? struct MyApp {
values: Vec<u32>,
}
impl Default for MyApp {
fn default() -> Self {
Self {
values: (1..(1 << 23)).collect(),
}
}
}
impl eframe::App for MyApp {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
let height = TextStyle::Body.resolve(ui.style()).size;
ScrollArea::vertical().show_rows(ui, height, self.values.len(), |ui, row_range| {
ui.allocate_space([ui.available_width(), 0.0].into());
for i in row_range {
let Some(value) = self.values.get(i) else {
continue;
};
ui.label(format!("{value:08x}"));
}
})
});
}
} This seems to work fine up to 2^23 items, but with more than that you start having floating-point precision problems, since all the positions are stored in f32 which has 24 bits of precision. |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How Can i Create a Scrollable list of the Number's using the egui & eframe like in the image but 1 Column.
data is the 32 bit hex char.
and
|
is the scrolling barThe Data Is an long Array So it is Super Slow, & I reeded the the Doc.
Beta Was this translation helpful? Give feedback.
All reactions