|
Summary I'm still naive enough to think the "default" form properties should give the most "mileage" when developing an application. Unfortunately, the default form properties in Delphi/Kylix CLX can give unexpected and undesirable results, especially when porting from Windows/Delphi to Linux/Kylix. I suggest the default form AutoScroll=TRUE property should be changed to FALSE to prevent unexpected portability problems of CLX applications. I'm not crazy about the default Scaled=TRUE form property either, since scaling of fonts in Linux seems to be somewhat unpredictable, and can be different from Windows scaling. A Windows CLX application and a Linux CLX application can look quite different when the fonts are scaled differently, and attributes like bolding can look quite different, too. Even with form properties AutoScroll=FALSE and Scaled=FALSE, fonts can look somewhat different in a Windows and Linux CLX application, but this seems to be the best choice of form properties -- at least for the applications that I develop. Background Consider this simple CRC Calculator application that I recently improved and converted from a VCL application to a CLX application. At first I used all default form properties, specifically, Scaled=TRUE and AutoScroll=TRUE. With Windows/Delphi using small fonts (96 DPI) or with Linux/Kylix using a 96 DPI X Server, the application looked as expected: |

(Note: GIF compression introduces some artifacts in the screen shots shown
on these web pages.)
| With Windows large fonts (120 DPI), or with a 75 DPI X-Server in Linux (see TForm PixelsPerInch notes for how to configure an X-Server), unexpected and unwanted scroll bars appeared, at least sometimes because of variability in font scaling: |
Who wants these scroll bars in some environments?

| Here's a related Borland VCL article: Form display with different screen resolutions |
| A variety of form property settings were examined to
determine which combination had the least undesirable side
effects. The following tables show what happens with various
Scaled and AutoScroll properties of a form:
Table 1. Default Form
Properties: Scaled=TRUE, AutoScroll=TRUE Each table is a summary of an additional web page that shows what a form looks like in both the Integrated Development Environment (IDE) and at run time both with Windows/Delphi and Linux/Kylix.
|
Table 1. Default Form
Properties: Scaled=TRUE, AutoScroll=TRUE
Goal: Forms stay the same physical size in pixels as at design
time in the IDE, but fonts and objects may be scaled at run time.
Add scroll bars at run time when the scaled objects exceed the original
design-time form size. A "committee" solution?
|
This table summarizes the screens shown on this page with additional details about Default Form Properties: Scaled = TRUE, AutoScroll = TRUE. The same CLX source code is compiled in Windows/Delphi and Linux/Kylix with no changes. |
|
|
Delphi / Kylix IDE |
Run Time |
| Windows Delphi 7, PixelsPerInch=96 (OK) Scaled=TRUE, AutoScroll=TRUE "Small Fonts", 96 DPI |
Windows 2000 Run Time (OK) "Small Fonts", 96 DPI |
| Windows 98 Run Time, "Large Fonts", 120 DPI (undesired scroll bars) | |
| Red Hat 7.2, Kylix 3, PixelsPerInch=96 (OK) Scaled=TRUE, AutoScroll=TRUE 96 DPI X-Server |
Red Hat 7.2, Run Time (OK) 96 DPI X-Server |
| In Red Hat 7.2, or when using the same Red Hat 7.2 executable in Mandrake 9.0, with a 75 DPI X Server there is unexpected/inconsistent scaling. | |
| Mandrake 9.0, Kylix 3, PixelsPerInch=75 (undesirable scroll bars) Scaled=TRUE, AutoScroll=TRUE 75 DPI X Server |
Mandrake 9.0 Run Time (undesirable scroll bars) 75 DPI X Server |
| Same Mandrake 9.0 Executable (undesirable scroll bars) in RedHat 7.2 with 96 DPI X Server |
|
| Conclusion: Default form properties can result in source code that is NOT portable to all desired platforms and environments -- at least without source code modification. Likewise, default form values can result in executables that are NOT portable to other environments, without source code modification and recompilation to prevent unexpected scroll bars. Default form properties are not very desirable. |
Note: Mandrake 9.0 is not a supported Linux distribution for Kylix 3 (only Red Hat 7.2, Mandrake 8.2 and SuSe 7.3 are supported Linux distributions. Comment by Craig Stuntz (Team B): AutoScroll, AFAICS, should never be used at all, CLX or VCL. |
| I wanted to come up with source code that would work in
either Windows or Linux without any changes on either platform. I wanted a Windows/Delphi executable that looks
good with either small fonts (96 DPI) or large fonts (120 DPI), and a
Linux/Kylix executable that looks good whether the X-Server was
configured to 75 DPI or 96 DPI (or, in theory, other
values). Shouldn't this happen automatically with the default form
properties?
The "normal" Windows/Delphi solution for "small fonts (96 DPI)" and "large fonts (120 DPI)" is to set AutoScroll=FALSE but leave Scaled=TRUE. This works fairly well in Windows, but font scaling doesn't work as well (and as consistently) in Linux. |
Table 2. Form Properties:
Scaled=TRUE, AutoScroll=FALSE
Goal: Forms stay the same physical Size -- but only in
"logical" inches.
| Given a form with Width=380 pixels and Height=228
pixels.
With 96 dots per inch (DPI), this form will appear to be 380/96 = 3.958" wide by 228/96 = 2.375" wide (110.5 mm by 60.3 mm). Now given a 75 DPI screen setting and the same physical form size, the number of pixels in the form must change: 3.958" * 75 DPI = 297 pixels by 2.375" * 75 DPI = 178 pixels. So what's the problem? You can have a 14", 15", 17", or 19" monitor, or a hugh Sony Jumbotron configured to have 1024 pixels by 768 pixels. Can all these screens have a single 96 DPI setting, like many do in Windows? "Inches" on the screen don't mean "physical inches" but rather "logical inches", i.e., "pretend inches", which can be nearly any size. Scaling lines and fonts in a discrete pixel world at two different sizes can result in quite noticeable differences between different sized screens. |
|
This table summarizes the screens seen on this page with additional details about Form Properties: Scaled = TRUE, AutoScroll = FALSE. The same CLX source code is compiled in Windows/Delphi and Linux/Kylix, but a PixelsPerInch change was made in Linux. |
|
|
Delphi / Kylix IDE |
Run Time |
| Windows Delphi 7, PixelsPerInch=96 Scaled=TRUE, AutoScroll=TRUE "Small Fonts", 96 DPI |
Windows 2000 Run Time "Small Fonts", 96 DPI |
| Windows 98 Run Time, "Large Fonts", 120 DPI | |
| Red Hat 7.2, Kylix 3, PixelsPerInch=96 (OK) Scaled=TRUE, AutoScroll=TRUE 96 DPI X- Server |
Red Hat 7.2, Run Time 96 DPI X- Server |
| Same Red Hat 7.2 Executable in Mandrake 9.0 with 75 DPI X- Server Unclear why TLabels at bottom do not scale well. Form has fewer pixels so size in 75 DPI environment matches screen size from 96 DPI environment. |
|
| Mandrake 9.0, Kylix 3, PixelsPerInch=75 Scaled=TRUE, AutoScroll=TRUE 75 DPI X Server |
Recompile CLX program with modified PixelsPerInch. Mandrake 9.0 with 75 DPI X-server |
| Same Mandrake 9.0 Executable (compiled for 75 DPI) in Red hat 7.2 with 96 DPI X Server Form has more pixels so size in 96 DPI environment matches screen size from 75 DPI environment. |
|
| Conclusion: A Windows/Delphi executable works fine with small fonts (96 DPI) or large fonts (120 DPI). A Linux/Kylix executable (compiled when the X-Server was 96 DPI) has a slightly different appearance when deployed to a 96 DPI X-Server and a 75 DPI X-Server. Similar scaling is seen in IDE and runtime, but only when form PixelsPerInch property matches the DPI of the X-Server being used. Some TLabels didn't rescale well when displaying a CLX program compiled with PixelsPerInch=96 with 96 DPI X-Server on another machine with a 75 DPI X-Server. The converse worked better: All TLabels scaled fairly well when displaying a CLX program compiled with PixelsPerInch=75 with 75 DPI X-Server on another machine with a 96 DPI X-Server. I do not like the unpredictable scaling of some fonts when using a different X-Server DPI environment. However, these results are still better than the scroll bars that can appear with the default form properties. |
| Note: Mandrake 9.0 is not a supported Linux distribution for Kylix 3. |
Table 3. Form Properties:
Scaled=FALSE, AutoScroll=FALSE
Goal: Forms Stay the Same Size in Pixels, but physical size can
be different.
|
All forms have Width=380 pixels and Height=228 pixels |
|
This table summarizes the screens shown on this page with additional details about Form Properties: Scaled = FALSE, AutoScroll = FALSE. The same CLX source code is compiled in Windows/Delphi and Linux/Kylix. |
|
|
Delphi / Kylix IDE |
Run Time |
| Windows Delphi 7, PixelsPerInch=96 (OK) Scaled=TRUE, AutoScroll=TRUE "Small Fonts", 96 DPI |
Windows 2000 Run Time (OK) "Small Fonts", 96 DPI |
| Windows 98 Run Time, "Large Fonts", 120 DPI | |
| Red Hat 7.2, Kylix 3, PixelsPerInch=96 (OK) Scaled=TRUE, AutoScroll=TRUE 96 DPI X- Server |
Red Hat 7.2, Run Time (OK) 96 DPI X- Server |
| Same Red Hat 7.2 Executable (OK) in Mandrake 9.0 with 75 DPI X- Server |
|
| Mandrake 9.0, Kylix 3, PixelsPerInch=75
(OK) Scaled=TRUE, AutoScroll=TRUE 75 DPI X Server |
Recompile CLX program with modified (OK) PixelsPerInch. Mandrake 9.0 with 75 DPI X-server |
| Same Mandrake 9.0 Executable (OK) (compiled for 75 DPI) in Red hat 7.2 with 96 DPI X Server |
|
| Conclusion: Forms stay the same size in
pixels but may appear as a different physical size depending on the
PixelsPerInch screen setting.
Having identical fonts in Windows and Linux would be nice, but I guess that's too much to ask. |
| Note: Mandrake 9.0 is not a supported Linux distribution for Kylix 3. |
Updated 01 Jan 2003
since 31 Dec 2002