Documentation for Application's Scaled property lazarus / 31-LCL ---------------------------------------------------------------------- jwdietrich · 2019-06-26 23:54 When compiling one of my projects on an older Lazarus version (1.6 for Raspbian) I stumbled over the line Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Application.Scaled := True; in the main project file. This old Lazarus version compiles the app after commenting out this line only. What is the function of this property? Following the source code inspector, it seems to be defined in the forms unit and to do nothing more than to read or write the private FScaled variable. Is there any documentation available? I didn't find anything (apart from this old mail: https://lists.lazarus- ide.org/pipermail/lazarus/2017-February/230964.html, but it doesn't provide satisfactory information). ---------------------------------------------------------------------- trev · 2019-06-27 00:07 I thought it was to ensure that your form did not shrink on high DPI monitors.  I could be wrong; I've been wrong before ---------------------------------------------------------------------- jwdietrich · 2019-06-27 12:52 By inspecting the SVN archive I at least found out that this property was introduced with version 1.8 of the LCL. So I can restrict its integration to newer versions with the help of compiler condictionals. However, I would prefer to know what I do. This property must be documented anywhere, beyond the more than sparse information to be found in the wiki. ---------------------------------------------------------------------- lucamar · 2019-06-27 13:57 I may be wrong but I kind of remember having read somewhere that Scaled is there for compatibility with the VCL; i.e. it does nothing. I was wrong; see below after "ETA" But to make sure just try to find where, if anywhere, either the property or the field are read from/written upon. Setters for size/position and similar methods are good candidates, as well as methods which create controls, like CreateForm(), etc. ETA: I was wrong. doing a: grep -Fir "application.scaled" * in the LCL directory results in: Code: [Select]buttonpanel.pas:      if Application.Scaled and AParent.Scaled then include/customform.inc:  if Application.Scaled and Scaled and (Monitor.PixelsPerInch<>PixelsPerInch) then include/customform.inc:  if Application.Scaled and (PixelsPerInch<>Monitor.PixelsPerInch) then include/customform.inc:      if Application.Scaled and (ParentForm<>nil) and ParentForm.Scaled include/customform.inc:    if Application.Scaled and Scaled and (NewDpi<>PixelsPerInch) then include/customform.inc:  if Application.Scaled and Scaled and (Monitor.PixelsPerInch<>PixelsPerInch) then include/hintwindow.inc:  if Application.Scaled and Scaled and (Mon<>nil) and (PixelsPerInch<>Mon.PixelsPerInch) then include/customdesigncontrol.inc:  if Application.Scaled then include/customdesigncontrol.inc:  if Application.Scaled and Scaled then include/customframe.inc:    if Application.Scaled and (ParentForm<>nil) and ParentForm.Scaled which is just a minimum; there are probably more instances of use in there and in "./components/" and elsewhere. ---------------------------------------------------------------------- jwdietrich · 2019-06-27 14:53 Quote from: lucamar on June 27, 2019, 03:57:07 pmETA: I was wrong. doing a: grep -Fir "application.scaled" * in the LCL directory results in: Code: [Select]buttonpanel.pas:      if Application.Scaled and AParent.Scaled then include/customform.inc:  if Application.Scaled and Scaled and (Monitor.PixelsPerInch<>PixelsPerInch) then include/customform.inc:  if Application.Scaled and (PixelsPerInch<>Monitor.PixelsPerInch) then include/customform.inc:      if Application.Scaled and (ParentForm<>nil) and ParentForm.Scaled include/customform.inc:    if Application.Scaled and Scaled and (NewDpi<>PixelsPerInch) then include/customform.inc:  if Application.Scaled and Scaled and (Monitor.PixelsPerInch<>PixelsPerInch) then include/hintwindow.inc:  if Application.Scaled and Scaled and (Mon<>nil) and (PixelsPerInch<>Mon.PixelsPerInch) then include/customdesigncontrol.inc:  if Application.Scaled then include/customdesigncontrol.inc:  if Application.Scaled and Scaled then include/customframe.inc:    if Application.Scaled and (ParentForm<>nil) and ParentForm.Scaled which is just a minimum; there are probably more instances of use in there and in "./components/" and elsewhere. Thanks, I found out about the same in parallel to you. This property seems to have to do with adaptation to high-resolution (e.g. Retina) displays. ---------------------------------------------------------------------- lucamar · 2019-06-27 15:04 Quote from: jwdietrich on June 27, 2019, 04:53:43 pmThanks, I found out about the same in parallel to you. This property seems to have to do with adaptation to high-resolution (e.g. Retina) displays. Yes, it has to do with HighDPI adaptation. But it seems to be just a hint: "hey, the programmer wants ..." and child controls ignore it or not at their will My guess is that it's meant for those controls which are not automagically scaled by the OS, so they know they should do it themselves. ---------------------------------------------------------------------- Ondrej Pokorny · 2019-07-03 08:11 https://wiki.lazarus.freepascal.org/High_DPI ---------------------------------------------------------------------- wp · 2019-07-03 10:05 Quote from: jwdietrich on June 27, 2019, 01:54:51 amWhen compiling one of my projects on an older Lazarus version (1.6 for Raspbian) I stumbled over the line Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Application.Scaled := True; in the main project file. This old Lazarus version compiles the app after commenting out this line only. What is the function of this property? In addition to Ondrej's post I'd like to add that "Application.Scaled := true" is added whenever the box "Use LCL scaling" of "Project options" > "Application" has been checked (which is the default in Laz 2.0+). It activates automatic scaling of controls according to screen resolution. ---------------------------------------------------------------------- jwdietrich · 2019-07-08 10:37 Thanks.