Screen Scaling and WINDEV

Screen Scaling and WINDEV

You don’t often get WINDEV tips from Uncle Pete as I spend the majority of my time in WEBDEV, but here’s a quick one for you.

We use to have a lot of display issues when someone had their screen scaling set to something other than 100%. In old versions of Windows this was referred to as Font Size.

With the latest versions of WINDEV, sorry not sure what version this was completely resolved, as long as we select the Enlarge the window and controls option on the window description, our windows scale as expected with the windows setting and we don’t even have to think about it.

Except (why is there always an except?), if we do anything fancy trickery to adjust the window any control sizes ourself. For example, take this screen:
That product section is a looper, However, depending on what type of product we are working on, any combination of Serial Number, IMEI, or SIM might be required. So we hide the unused ones and set the line height based on how many are required. Each line is 24 pixels tall so we calculated Looper Line Height like so:

x is int = 24 IF RequireSerialNumber THEN x += 24 END IF RequireIMEI THEN x += 24 END IF RequireSIM THEN x += 24 END RESULT x

This worked fine for most of the users, however, one user (you know who you are!) had their display set to 150% and it was chopping off the looper.

Enter the LargeFontFactor function. It tells us what that windows setting is, so if it is set to 150% LargeFontFactor returns 1.5. So just a small tweak to our code and now the display works correctly regardless of the windows setting.

EachLine is int = 24 * LargeFontFactor()

x is int = EachLine
IF RequireSerialNumber THEN
	x += EachLine
END
IF RequireIMEI THEN
	x += EachLine
END
IF RequireSIM THEN
	x += EachLine
END

RESULT x

With this code, when set to 150%, EachLine calculates to 24 * 1.5 = 36, and our looper line height works as expected.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s