Egui questions regarding window size

Using egui:

I have a question:

            egui::Window::new("Projects")
            .fixed_pos(egui::pos2(0f32, 0f32))
            .fixed_size(egui::vec2(1920f32, 1080f32))
            .open(&mut open_projects)
            .show(ctx, |ui|

I have this code but it always draws the exact small window no matter what the allocated fixed_size is.

Can somebody please advise me what I should do to change the size of the window?
image

Refer to Window in egui::containers - Rust

-.fixed_size(egui::vec2(1920f32, 1080f32))
+.default_size(egui::vec2(1920f32, 1080f32))
+.resizable(true)

It says for fixed_size()

Sets the window size and prevents it from being resized by dragging its edges.

Which is what I want, I don't want it to be resizable. So how come the screensize is not right though still?

I have the exact same problem. No matter I tried default_size(...) , min_width(...) or fixed_size(...) it doesn't work. I got the impression that it goes to default size anyway

1 Like
2 Likes

It looks like the issue linked by @vague is probably the issue, but one thing you might try putting this at top of the code inside the window:

ui.set_width(ui.available_width());
ui.set_height(ui.available_height());

I think I've done something like this before, but haven't tested and it might not work.

3 Likes

Where do I exactly put it over here:

egui::Window::new("Projects")
            .fixed_pos(egui::pos2(0f32, 0f32))
            .fixed_size(egui::vec2(1920f32, 1080f32))
            .open(&mut open_projects)
            .show(ctx, |ui|

?

Anyways it works thank you :slight_smile:

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.