Using different measurement units on windows

Clarion uses dialog units as screen position measurement unit when designing windows. This is fixed and cannot be changed at design time, but it can be changed at runtime. For window design we can use PROP:Pixels and to change to pixels it is a simple matter of setting PROP:Pixels to true for the window object, like:

 WindowLabel {PROP:Pixels} = True

Or:

 0 {PROP:Pixels} = True

Since 0 (zero) always refers to the structure of the current target object. To set the window back to using dialog units, simply set PROP:Pixels to false:

 0 {PROP:Pixels} = False

It may not be immediately obvious, but you can also use a few other measurement units when dealing with windows at runtime. There are 3 more measurement units that can be used: PROP:Thous, PROP:mm and PROP:Points. If you set the properties to false Clarion goes back to dialog units. Normally we would only think of using PROP:Thous, PROP:mm and PROP:Points on reports, but they work equally well on windows!

The smallest unit you can use with PROP:Thous is 1 which equals 0.0254mm. Point is 1/72" equal to about 0.353mm. With millimeters, the smallest unit is 2 (or at least it used to be) or 100 times bigger than the smallest unit with PROP:Thous, which makes it pretty much useless for any precision placements. If I need to set sizes in metric units I convert to 1/1000" It may not always be perfect but for most things I think it is close enough.

If you have a control on a report, for example a fixed width textbox and you want the user of your software to be able to format the contents on a window so that it will look exactly as it will print, you can get the measurement from the report and use it to set the size of the textbox on a window. Let

Leave a Reply