Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

group widgets ignore horizontal wrapping #1996

Open
RainbowCookie32 opened this issue Sep 2, 2022 · 5 comments
Open

group widgets ignore horizontal wrapping #1996

RainbowCookie32 opened this issue Sep 2, 2022 · 5 comments
Labels
bug Something is broken

Comments

@RainbowCookie32
Copy link

Describe the bug

When using ui.group() inside something like ui.horizontal_wrapped(), the widgets seem to ignore wrapping and just keep going well past screen boundaries. I went crazy trying to figure out why my UI was overflowing, until I removed the group and it started wrapping as expected.

To Reproduce

I put together this simple sample with eframe that triggers the issue:

#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use eframe::egui;

#[derive(Default)]
struct DummyApp;

impl eframe::App for DummyApp {
    fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
        egui::CentralPanel::default().show(ctx, | ui | {
            ui.horizontal_wrapped(| ui | {
                for n in 0..500 {
                    ui.group(| ui | {
                        ui.strong(format!("Number {n}"));
                    });
                }
            });
        });
    }
}
fn main() {
    let app = DummyApp::default();
    let native_options = eframe::NativeOptions::default();

    eframe::run_native("wrap_test", native_options, Box::new(|_| Box::new(app)));
}

Expected behavior

The widgets don't overflow, and they keep going on a new row.

Screenshots
  • UI goes off-screen.

image


  • Wraps as expected without the group

image

Desktop (please complete the following information):

  • OS: Windows
  • Version: 10

Let me know if anything else is needed here :)

@RainbowCookie32 RainbowCookie32 added the bug Something is broken label Sep 2, 2022
@pinkponk
Copy link

pinkponk commented Nov 2, 2022

Also encountered this. There will also be a problem when using ui.vertical() instead of ui.group.

@birdistheword96
Copy link

I have the same issue on egui v0.24, using eframe to build a native desktop application on windows 10.

@tomellm
Copy link

tomellm commented Feb 19, 2024

I'm having the same problem, but also doesnt seem to work when using .horizontal(). with egui="0.26.2"

@by-lars
Copy link

by-lars commented Mar 3, 2024

Same, the only way i was sort of able to fix this was by wrapping the group in ui.allocate_ui.
But this still caused the outer margins to be incorrect.

@tomellm
Copy link

tomellm commented Mar 4, 2024

another way to fix it that I found was to use ui.add_sized. Like this you give it a size and then anything you put inside will kindof work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

No branches or pull requests

5 participants