PDA

View Full Version : UI difference between bundled app and running from thinAir



EmbeddedMan
13-02-2018, 19:05
I get different styles of controls when I bundle my app:

9821

On the left you'll see the way it looks when run from a bundled an app.

On the right is how it looks when run from ThinAir.

Is there an easy way to maintain consistency across both ways of running the program? (i.e. make them both look the same)

This is on a Windows 7 computer.

*Brian

ErosOlmi
13-02-2018, 19:22
Yes, it's a bug.

Bundled executables are produced adding themed manifest in the executable produced by thinBundle.
So the operating system (Windows) creates windows and controls in themed layout.

When you execute a script from inside thinAir, the script is executed by the thinBasic.exe executable that has no manifest file inside.
The operating system (Windows) does not find the theme inside the manifest so it creates windows and controls using unthemed layout.

I will add theme manifest inside thinBasic.exe to uniform the layout.

Reference: https://msdn.microsoft.com/en-us/library/windows/desktop/bb773175(v=vs.85).aspx

Thanks
Eros

EmbeddedMan
13-02-2018, 19:25
Very good! Thanks for the explanation. It's not a huge deal to me, but it does mean I have to use the bundled app to generate all training documentation. I'm also having trouble with fonts changing as I run the code on different machines, but I think that's a separate issue.

*Brian

EmbeddedMan
09-05-2018, 21:15
I'm wondering if you have any ideas for how to prevent the sizes of things from changing in my GUI windows between computers. Here are three screen captures on three different computers - all running Windows 7. Each window shows differences in font size and widget size that are giving me problems. I can't accurately size the text fields for each chunk of text on my GUI when I don't know how big the text will be on a user's computer.

I'm using the latest Beta of TB (not that this would fix my problem). All three of these screen captures are from running the exact same bundled executable.

I'm setting the font size in my code for most of the text elements in the window. For example, like this :



Global hCourierNew16Bold As Long Resource = Font_Create("Courier New", 16, %FONT_BOLD)

Control Add Label, CBHNDL, %ID_LargePowerLabel, "Power" , 200, 25, 80, 30
Dialog Send (Win_GetDlgItem(CBHNDL, %ID_LargePowerLabel)), %WM_SETFONT, hCourierNew16Bold, 0
Control Set Color CBHNDL, %ID_LargePowerLabel, %POWER_COLOR, -1


So, why the differences, and more importantly, what can be done to make this UI look exactly the same no matter what machine it runs on? Any ideas?

*Brian

9849

9850

9851

ErosOlmi
09-05-2018, 21:38
Yes, that's a problem.
UI module is not DPI aware, something I need to work on.

How is font dpi configured in your different computers?
https://www.google.com/search?q=windows+7+change+font+size+dpi&source=lnms&tbm=isch&sa=X&ved=0ahUKEwi92dvKsPnaAhWIWRQKHSpGCE4Q_AUICigB&biw=1918&bih=989#imgrc=7YsDhRJ40G8tGM:

EmbeddedMan
09-05-2018, 21:59
And of course, 30 minutes after posting my problem, I solve it. Yes, we both thought of the same thing.

The difference was exactly that - some machines were configured for "Medium 125%" and the others for "Smaller 100%".

I'm assuming there's no way for my code to be able to detect which setting a user has set on their system is there? If there were, I could adjust all of the font sizes so that everything stayed the same.

For now, I'm just going to ask all my users to set their machines to the 100% option if they want things to look "right". Good enough.

*Brian

ErosOlmi
09-05-2018, 22:09
I'm pretty sure there is something that let know about that but honestly is an area I didn't cover in my study of Windows
I need to study it a bit and then release new functions.

I will let you know

Ciao
Eros