You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Label currently ignores the max size when adding via add_sized. This only seems to be taken into account when wrap is set to true. I would ideally like to set a maximum size for the label and then simply have it not display any text that doesn't fit in the specified width (possibly replacing it with ... to indicate the full label is not being displayed).
ui.horizontal(|ui| {
ui.add_sized([100.0,10.0], egui::Label::new("My very long description"));
ui.button("Remove");}
Regardless of the specified width in add_sized, the label is displayed in full.
As a proposed solution, perhaps an API similar to the below:
/// Describes how to handle exceeding allocated size for the widget (label)enumExceedDimension{/// Force extend the dimension (e.g. width/height) of the label so that all text is displayedExtend,/// Wrap the text so that it fits within the specified width, but /// potentially extends the height past the requested sizeWrap,/// Truncate text so that it fits within the specified boundsTruncate,}// ...
ui.horizontal(|ui| {
ui.add_sized([100.0,10.0],
egui::Label::new("My very long description").on_exceed_width(ExceedDimension::Truncate));
ui.button("Remove");}
Alternatively, maybe there is a different way to achieve what I am trying to achieve - essentially as in the example above, I would like to always have the button visible at the cost of the full description. This appears in a SidePanel so I want the width to be tied to the current width of the SidePanel (minus the width of the button) so that the button always appears at the very right of the screen/panel.
The text was updated successfully, but these errors were encountered:
Label currently ignores the max size when adding via
add_sized
. This only seems to be taken into account whenwrap
is set totrue
. I would ideally like to set a maximum size for the label and then simply have it not display any text that doesn't fit in the specified width (possibly replacing it with...
to indicate the full label is not being displayed).Regardless of the specified width in
add_sized
, the label is displayed in full.As a proposed solution, perhaps an API similar to the below:
Alternatively, maybe there is a different way to achieve what I am trying to achieve - essentially as in the example above, I would like to always have the button visible at the cost of the full description. This appears in a
SidePanel
so I want the width to be tied to the current width of theSidePanel
(minus the width of the button) so that the button always appears at the very right of the screen/panel.The text was updated successfully, but these errors were encountered: