egui icon indicating copy to clipboard operation
egui copied to clipboard

horizontal_centered fails in table cell if a vertical layout is within

Open markusdd opened this issue 3 years ago • 1 comments

Describe the bug

I wish to basically group a checkbox and a combobox vertically, and then have it centered in cell vertically. So I tried it with the commented code below, but when I do this, the following happens:

grafik

To Reproduce Steps to reproduce the behavior:

                                row.col(|ui| {
                                    let checklabel;
                                    if finished[i] {
                                        checklabel = "Download (already done)";
                                    } else {
                                        checklabel = "Download";
                                    }
                                    ui.horizontal_centered(|ui| {
                                        // FIXME this breaks the centering ui.vertical(|ui| {
                                        // TODO raise ticket with egui
                                        ui.checkbox(&mut checked[i], checklabel);
                                        ComboBox::from_id_source(video_id)
                                            .selected_text(format!("{:?}", sel_paths[i]))
                                            .width(200.0)
                                            .show_ui(ui, |ui| {
                                                for p in paths.iter() {
                                                    ui.selectable_value(
                                                        &mut sel_paths[i],
                                                        p.to_string(),
                                                        p,
                                                    );
                                                }
                                            });
                                        // });
                                    });
                                });

Expected behavior I would expect the checkbox and combobox to be on top of each other (vertical layout) and then, through the horizontal_centered environment have then centered inside the cell vertically. currently I can only achieve this if they are next to each other: grafik

Desktop (please complete the following information):

  • OS: Windows WSLg
  • Version 11

Additional context egui 0.19.

This issue MIGHT be obsolete, but I cannot test 0.20.0 because of #2425

markusdd avatar Dec 09 '22 16:12 markusdd

FYI the problem persits with egui 0.20.0, tested on MacOS and also again on WSLg using wgpu backend.

markusdd avatar Dec 10 '22 12:12 markusdd