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

[Mac] Labels not sized correctly in PixelLayout #1747

Closed
benohub opened this issue Jul 15, 2020 · 3 comments · Fixed by #1798
Closed

[Mac] Labels not sized correctly in PixelLayout #1747

benohub opened this issue Jul 15, 2020 · 3 comments · Fixed by #1798
Labels
Milestone

Comments

@benohub
Copy link

benohub commented Jul 15, 2020

var application = new Application(Eto.Platform.Detect);
var layout = new PixelLayout();
layout.Add(new Label { Text = "Hello world", BackgroundColor = Colors.Yellow }, 50, 50);
layout.Add(new Label { Text = "Bonjour monde", BackgroundColor = Colors.LightGreen }, 20, 20);
application.Run(new Form { ClientSize = new Size(200, 200), Content = layout });

Expected & Actual Behavior

The above code works in WPF and GTK where labels are sized based on Text. In Mac64 (v2.5.2), the labels are too small and text is cut off. It's possible to work around it by wrapping each label in either a DynamicLayout, TableLayout or StackLayout, but it should not be necessary imho.

LabelsInPixelLayout

@cwensley
Copy link
Member

Hey @benohub, thanks for reporting the issue!

@cwensley cwensley added this to the 2.5.x milestone Jul 15, 2020
@benohub
Copy link
Author

benohub commented Jul 16, 2020

Resetting naturalSizeInfinity to null in MacLabel.OnLoad fixes the issue:

public abstract class MacLabel<...>
{
...
public override void OnLoad(EventArgs e)
{
base.OnLoad(e);
SetAttributes(true);
naturalSizeInfinity = null;
}
...
}

@cwensley
Copy link
Member

Hey @benohub, thanks again for reporting the issue! This should be fixed in 2.5.7 when released.

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

Successfully merging a pull request may close this issue.

2 participants