|
4 | 4 | //! Takes all available height, so if you want something below the table, put it in a strip.
|
5 | 5 |
|
6 | 6 | use egui::{
|
7 |
| - scroll_area::ScrollBarVisibility, Align, NumExt as _, Rangef, Rect, Response, ScrollArea, Ui, |
8 |
| - Vec2, Vec2b, |
| 7 | + scroll_area::{ScrollAreaOutput, ScrollBarVisibility}, |
| 8 | + Align, NumExt as _, Rangef, Rect, Response, ScrollArea, Ui, Vec2, Vec2b, |
9 | 9 | };
|
10 | 10 |
|
11 | 11 | use crate::{
|
@@ -474,7 +474,7 @@ impl<'a> TableBuilder<'a> {
|
474 | 474 | }
|
475 | 475 |
|
476 | 476 | /// Create table body without a header row
|
477 |
| - pub fn body<F>(self, add_body_contents: F) |
| 477 | + pub fn body<F>(self, add_body_contents: F) -> ScrollAreaOutput<()> |
478 | 478 | where
|
479 | 479 | F: for<'b> FnOnce(TableBody<'b>),
|
480 | 480 | {
|
@@ -515,7 +515,7 @@ impl<'a> TableBuilder<'a> {
|
515 | 515 | scroll_options,
|
516 | 516 | sense,
|
517 | 517 | }
|
518 |
| - .body(add_body_contents); |
| 518 | + .body(add_body_contents) |
519 | 519 | }
|
520 | 520 | }
|
521 | 521 |
|
@@ -641,7 +641,7 @@ impl<'a> Table<'a> {
|
641 | 641 | }
|
642 | 642 |
|
643 | 643 | /// Create table body after adding a header row
|
644 |
| - pub fn body<F>(self, add_body_contents: F) |
| 644 | + pub fn body<F>(self, add_body_contents: F) -> ScrollAreaOutput<()> |
645 | 645 | where
|
646 | 646 | F: for<'b> FnOnce(TableBody<'b>),
|
647 | 647 | {
|
@@ -692,7 +692,7 @@ impl<'a> Table<'a> {
|
692 | 692 | let widths_ref = &state.column_widths;
|
693 | 693 | let max_used_widths_ref = &mut max_used_widths;
|
694 | 694 |
|
695 |
| - scroll_area.show(ui, move |ui| { |
| 695 | + let scroll_area_out = scroll_area.show(ui, move |ui| { |
696 | 696 | let mut scroll_to_y_range = None;
|
697 | 697 |
|
698 | 698 | let clip_rect = ui.clip_rect();
|
@@ -843,6 +843,7 @@ impl<'a> Table<'a> {
|
843 | 843 | state.max_used_widths = max_used_widths;
|
844 | 844 |
|
845 | 845 | state.store(ui, state_id);
|
| 846 | + scroll_area_out |
846 | 847 | }
|
847 | 848 | }
|
848 | 849 |
|
|
0 commit comments