These are chat archives for picoe/Eto

25th
Feb 2018
Starz0r
@Starz0r
Feb 25 00:51
What's the process for adding etoViewport to a project?
philstopford
@philstopford
Feb 25 01:59
@cra0zy I can't automate the layout of my UI. It's too complicated, so I've been forced to a PixelLayout, but then some Linux distributions (e.g. CentOS) seem to mangle the GTK UI that looks fine under Linux Mint. Currently, it looks fine on WinForms, WPF, and Linux Mint GTK, so I was trying to address whatever breaks the vertical layout on CentOS.
It looks like the CentOS font setting might be screwing with things, so I was curious to see if I could force the font from within the application.
@Starz0r : there's an example in the github repository. Given the platform-specific nature of the GL implementation, you need to build different binaries for the target OS. You can see how this works by looking through the test application in the repo
Harry
@cra0zy
Feb 25 10:17
Gtk has theming
each theme has different font and sizing that it uses
so you can't assume anything
Simonas G
@SlowLogicBoy
Feb 25 10:18
that's why I use as less styling as I can :)
Most of what I style is spacing padding that's all
Allow users to chose what they want
Harry
@cra0zy
Feb 25 10:19
same here
Simonas G
@SlowLogicBoy
Feb 25 10:19
I guess Styling only would work on WPF and maybe on WinForms
if client doesn't use DPI
Harry
@cra0zy
Feb 25 10:19
there are exceptions
Simonas G
@SlowLogicBoy
Feb 25 10:20
dang it just updated dotnet and got:
Welcome to .NET Core!
---------------------
Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs.

Telemetry
--------------
The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community.
You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell.
You can read more about .NET Core tools telemetry @ https://aka.ms/dotnet-cli-telemetry.
Harry
@cra0zy
Feb 25 10:20
meh
Simonas G
@SlowLogicBoy
Feb 25 10:20
srsly I need to set environment variable ?
Harry
@cra0zy
Feb 25 10:21
just set it in /etc/enviorment
Simonas G
@SlowLogicBoy
Feb 25 10:21
isnt it better to change this stuff in .bashrc ?
I don't want to interfere with system stuff -.-
Harry
@cra0zy
Feb 25 10:22
bashrc gets run by the terminal
that is, monodevelop would still be sending the data
because your environmental variable wouldn't be getting set in that case
Simonas G
@SlowLogicBoy
Feb 25 10:22
ahh... monodevelop is not opening via console -.-
that's right...
aren't there user specific environment variables where I could set?
/etc/environment is system wide :?
Harry
@cra0zy
Feb 25 10:24
its system wide
Simonas G
@SlowLogicBoy
Feb 25 10:24
~/.bash_profile ?
I guess that's same as bashrc ?
Harry
@cra0zy
Feb 25 10:25
.pam_environment and .profile
Simonas G
@SlowLogicBoy
Feb 25 10:25
thanks :bow:
philstopford
@philstopford
Feb 25 17:01
So, there's no way to find out the font metrics to make the PixelLayout values relative to that? If I can find that out, I can make the UI adaptive, I think....
As it stands, there's no way to fit it to a table/grid/whatever, given the complexity involved.
Harry
@cra0zy
Feb 25 17:08
You can get LineHeight of a font
and use that
philstopford
@philstopford
Feb 25 17:09
So, to put the pieces of the question together : how do I find out which font is going to be used, and then query the LineHeight of that font? I need it early enough to set the relevant values of the UI elements.
I spent some time hunting around and couldn't figure it out myself, so may be missing some part of the docs or example code.
(I was a little surprised that I couldn't just create objects (e.g. Buttons) and query the dimensions - they end up '-1' on WinForms, for example, so I think the font approach may be the best option in this situation)
Simonas G
@SlowLogicBoy
Feb 25 17:15
-1 means that size is managed by native platform in your case WinForms
#! "netcoreapp2.0"

#r "nuget: Eto.Platform.Gtk,*"

using Eto.Forms;
var app = new Application(new Eto.GtkSharp.Platform());
var button = new Button();
button.Text = $"{button.Font.FamilyName} {button.Font.Size}";
app.Run(new Form{
    Content = button
});
This show on button which Font and it's Size :)
also have you tried checking sizes after the form is ran ?
because for me it shows -1 only when it's before app.Run
after it shows it's actual size
Simonas G
@SlowLogicBoy
Feb 25 17:20
#! "netcoreapp2.0"

#r "nuget: Eto.Platform.Gtk,*"

using Eto.Forms;
var app = new Application(new Eto.GtkSharp.Platform());
var button = new Button();
button.Command = new Command((s, e) => {
    Console.WriteLine($"Button size after app.run: {button.Size}");
});
button.Text = $"{button.Font.FamilyName} {button.Font.Size}";
Console.WriteLine($"Button size before app.run: {button.Size}");
app.Run(new Form{
    Content = button
});
When ran:
Button size before app.run: -1,-1
and after I press the button:
Button size after app.run: 83,27
because before app is ran it doesn't know what size controls will be
you can try to get size in Form.Shown event, because there it has sizes. of course the control has to be shown, if it is not displayed it doesn't have size
philstopford
@philstopford
Feb 25 17:44
I wasn't sure how robust it would be to reconfigure the UI after the application has shown, to be honest. With many controls, I guess it might also get ugly.
This looks also like an option : float buttonHeight = tmpButton.Font.MeasureString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVVWXYZ").Height;
Curtis Wensley
@cwensley
Feb 25 19:01
@philstopford: using font metrics to adjust the position of elements it will ultimately fail; there's more than just the font that determines the size of controls on each platform. Buttons for example have different border styles on each platform which have their own sizes.
I'm very surprised you can't use TableLayout/StackLayout/DynamicLayout at all, is it just performance that is the issue?