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

min text area width? #61

Open
gilescope opened this issue May 9, 2022 · 6 comments
Open

min text area width? #61

gilescope opened this issue May 9, 2022 · 6 comments

Comments

@gilescope
Copy link

Is there a way we can force it to not have such narrow text areas? At the moment it seems to wrap at a line length of 7 chars or so.

egui_ctx.ctx_mut().set_style(egui::Style {
        wrap:Some(false),
        spacing: Spacing {
            text_edit_width: 1000.,
            ..default()
        },
        ..default()
    });

I tried the above but it seemed to make no effect. Other things are wider so it could use up more space if it wanted to but it chooses not to. Being able to set min / max text width as an attribute would be good.

@gilescope
Copy link
Author

gilescope commented May 9, 2022

Screenshot from 2022-05-09 07-15-22

Sometimes a picture is worth 1000 words...

@gilescope
Copy link
Author

@gilescope
Copy link
Author

It may be necessary but it's not sufficient. I think something in the parent component needs to change too.

@gilescope
Copy link
Author

Not using derive inspectable but implementing it myself on the parent was key:

        ui.vertical_centered(|ui| {
            Grid::new(context.id())
            .min_col_width(500.)
            .show(ui, |ui| {

Happy.

@XMPPwocky
Copy link

I believe this is caused by not setting num_columns on the Grid - https://docs.rs/egui/latest/src/egui/grid.rs.html#305-308 - so layout has no idea whether it needs to leave space for more columns.

Setting num_columns to 2 and then wrapping the field value inspector in ui.allocate_ui or whatever should make everything work much more sensibly.

@TeamDman
Copy link

TeamDman commented Mar 6, 2024

Before
image

After
image

Notice how frick is no longer cut off

fn ui_for_struct_readonly(
&mut self,
value: &dyn Struct,
ui: &mut egui::Ui,
id: egui::Id,
options: &dyn Any,
) {
Grid::new(id).show(ui, |ui| {

fn ui_for_struct_readonly(
        &mut self,
        value: &dyn Struct,
        ui: &mut egui::Ui,
        id: egui::Id,
        options: &dyn Any,
    ) {
        Grid::new(id)
+        .num_columns(2)
        .show(ui, |ui| {

Probably will want to add num_columns calls to all the other grid usages as well

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

No branches or pull requests

3 participants