how to set a fixed size for egui::TextEdit::multiline? #3423
Replies: 3 comments
-
I had to face the same issue and found out, that there is no good solution. Either you resize your font (the height of your TextEdit is determined by its font height) or you create a new window that creates a fixed frame. let fixed_size = vec2(200.0, 100.0);
ui.style_mut().visuals.window_shadow = Shadow::NONE;
ctx.set_style(ui.style().clone());
Window::new("")
.hscroll(true)
.movable(false)
.open(&mut true)
.current_pos(ui.next_widget_position())
.fixed_size(fixed_size)
.resizable(false)
.title_bar(false)
.vscroll(true)
.show(ctx, |ui| {
ui.add(TextEdit::multiline(&mut "my lines\n".repeat(100)));
}); It is really weird, that the normal window allows this TextEdit to go outside the frame and all of that stuff. Functions like max_height etc. do not seem to work either. |
Beta Was this translation helpful? Give feedback.
-
For a similar problem I used the following line to insert the sized multiline: |
Beta Was this translation helpful? Give feedback.
-
Just put it in ScrollArea |
Beta Was this translation helpful? Give feedback.
-
Im trying to make a TextEdit area that is scrollable in my gui but i cant find any thing in the docs for setting a height and width of TextEdit. I tried to use a Grid to try add a fixed_size but i think its the wrong tool for the job so the question is. Is there a way to set a fixed_size for TextEdit?
here is the relevant code:
Beta Was this translation helpful? Give feedback.
All reactions