ENABLE_UI_SCALING

Discussion forum about all things Team Developer 7.x
aspurga
Lithuania
Posts: 37
Joined: 06 Mar 2017, 08:54
Location: Lithuania

ENABLE_UI_SCALING

Post by aspurga » 06 Mar 2017, 08:58

High Resolution Display Support
  • To improve the usability of the toolbar, tree and other UI components of the IDE, icons will be scaled on high resolution displays that are using DPI scaling of 150% or greater. This prevents the icons from being much smaller than their label.
  • If this functionality is desired for application icons, it can be turned on using an environment variable: ENABLE_UI_SCALING
Please advise where variable should be used?

Thanks,


Arunas

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 1112
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

ENABLE_UI_SCALING

Post by Dave Rabelink » 06 Mar 2017, 09:47

I tried to find any documentation on this, besides the release notes.
Not found...

My guess is that you will have to add an environment variable having that name, but the value it should have is not mentioned.
(so not a variable in TD, but use the environment variable editor of Windows).

But if it is really true that we should use an environment variable, I'm disappointed in the design choice. It should be an application variable or a build option setting.

So, I'm not sure how to use it either.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 1112
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

ENABLE_UI_SCALING

Post by Dave Rabelink » 07 Mar 2017, 13:02

Jean-Marc Gemperle wrote:Hi,

TD 7.0 UPD1 only checks if ENABLE_UI_SCALING environment variable is defined or not, not matter its value. If it’s defined TD enables UI scaling at runtime, not for the IDE. If using images I.E.: in ribbon bar and tree control its images are scaling to match with current DPI. By default for backward compatibility it’s not enable.

For TD IDE scaling is enabled if the current DPI scaling is over 125%

Jean-Marc Gemperle

Sr. Technical Support | Technical Support
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

thomas.uttendorfer
Site Admin
Site Admin
Germany
Posts: 147
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

ENABLE_UI_SCALING

Post by thomas.uttendorfer » 08 Mar 2017, 08:58

Hi Dave,
you could set the environment variable just for application process scope with this function (I do that to manipulate PATH variable on SAM_AppStartup):

Kernel32.dll
Function: SetEnvironmentVariableA
Description: Sets the contents of the specified environment variable for the current process.
This function has no effect on the system environment variables or the environment variables of other processes.
Parameter:
lpName [in] The name of the environment variable. The operating system creates the environment variable if it does not exist and lpValue is not NULL.
lpValue [in, optional] The contents of the environment variable. The maximum size of a user-defined environment variable is 32,767 characters.
For more information, see Environment Variables.
Windows Server 2003 and Windows XP: The total size of the environment block for a process may not exceed 32,767 characters.
If this parameter is NULL, the variable is deleted from the current process's environment.
Export Ordinal: 0
Returns
Boolean: BOOL
Parameters
String: LPCSTR
String: LPCSTR
Thomas Uttendorfer
[ frevel & fey ] Software-System GmbH
https://thomasuttendorfer.wordpress.com/

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 1112
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

ENABLE_UI_SCALING

Post by Dave Rabelink » 08 Mar 2017, 09:29

Yes indeed Thomas, that is a good solution.

Still have to test it though WHEN this variable is read by the executable.
If it is before the SAM_AppStartup, there is no way to disable it from within the application and we must use a BATCH file to set/remove the variable depending on the started exe.

A system wide setting would affect all TD executables.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 1112
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

ENABLE_UI_SCALING

Post by Dave Rabelink » 14 May 2018, 07:11

Well....this is disappointing...

I tested the usage of the system environment variable ENABLE_UI_SCALING and unfortunately, the variable is read from the system way before SAM_AppStartup.

I created a testcase, a copy from the official ribbon menu sample. It tries to set the environment variable at SAM_AppStartup but it does not have the desired effect.
Then I tried to set the variable on the constructor of a global UDV variable, which is in fact fired before SAM_AppStartup.
Even then, the environment variable is not taken into account.

So, there is no way to let the application manage its scaling from the application itself.
The variable needs to be added/removed on global environment variable level OR set/removed in a batch file.

This makes it harder to have multiple TD applications running on the same workstation but where each application needs a different scaling setting.

I wonder why OpenText Gupta has decided to implement this feature this way. It would be way better to have a TD application build setting or a way to set/remove the variable from within the application.
The environment variable design seems to be a quick hack to have the feature quickly forced into the product (which is TD 7.0 UPD1).

Use the testcase (source included).
Always run executable.

Be sure to set the DPI (font scaling factor) to 150% or larger.
(logoff user and login to have Windows manage the DPI change correctly)

The batch files start the application having scaling on or off.
The application sets the environment variable on the constructor and at startup.

See that without using a batch file or setting the scaling on global level, the application does not take scaling into account.

RibbonMenu_ENABLE_UI_SCALING.zip

The application should show the scaling difference like in the screenshot below.

ENABLE_UI_SCALING.png
You do not have the required permissions to view the files attached to this post.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests