|
Title: | Enhancing Dialog Appearance with DLGSRV32 |
Document: | 896807291 |
Author: | Roland Genske (rhg@msede.com) |
Keywords: | DLGSRV32,Windows |
Enhancing Dialog Appearance with DLGSRV32
On migration from 16 bit DLGSRV to 32 bit DLGSRV32, the appearance of most
dialogs change in a way that is not expected. Mainly, edittext contents do
not fit anymore, statictext widths are incorrect and button/checkbox labels
are displayed with a line break.
We have investiged this problem:
-
With Windows 95 only the system fonts are correctly scaled to the
different screen resolutions. The system fonts available to be applied
in a Dialog Manager font resource definition are "SYSTEM_FONT",
"ANSI_FIXED_FONT" and "ANSI_VAR_FONT". Their sizes are determined
automatically by the operating system and cannot be specified in a
Dialog Manager font resource definition.
-
If a non-system font is used, such as "Courier New,10", a TrueType font,
the Dialog Manager font scaling algorithm obviously fails to calculate
the font dimensions correctly so that a dialog will not display
correctly in all possible screen resolutions.
-
The effect is that if you use "Courier New,10" as reference font as well
as for displaying edittext contents and button labels under Windows 95,
you will notice the effect that the edittext contents will not be
displayed completely and the button labels will be displayed with a line
break.
-
If you try to overcome this effect by choosing a larger font as
reference font, you will notice even more strange effects regarding
edittext contents where you either have a lot of white space in the
edittext or the contents will not be displayed completely, as in the
example above.
-
This limitation does not apply for Windows NT 4, which seems to use
a different font scaling algorithm internally.
Knowing these limitations, a few rules will help you to create scalable
dialogs which will always display correctly:
-
Do always use system fonts. We recommend to choose "ANSI_FIXED_FONT"
as reference font and "ANSI_VAR_FONT" as display font.
If you prefer a non-proportional font in your edittexts and listboxes
and perhaps for statictext headlines, you should use "ANSI_FIXED_FONT".
-
In order to display the edittext contents completely, you should add
2 width units to the number of characters you want to display. For
example, if you want to display 10 characters in an edittext, its
width should be set to 12.
If this overhead is too high for a specific dialog design, you can
disable the edittext border by setting .borderwidth to -1. This reduces
the overhead to 1 width unit, in the example above, the edittext width
should be set to 11 in this case.
-
For buttons, chechboxes and statictexts, you should use "ANSI_VAR_FONT"
which will display correctly if no width is specified. Otherwise, the
automatically calculated width may be too low and the button labels
would be displayed with a line break. In such a case, you should
explicitely specify the object's width.
The following example (modifications to the defaults section) assumes
that font variant 1 is used with the 32 bit DLGSRV32:
font RefFont {
...
1: "ANSI_FIXED_FONT";
...
}
font FixedFont {
...
1: "ANSI_FIXED_FONT";
...
}
font PropFont {
...
1: "ANSI_VAR_FONT";
...
}
...
default checkbox
{
...
.font PropFont;
.posraster true;
.sizeraster true;
...
}
...
default edittext
{
...
.font FixedFont;
.posraster true;
.sizeraster true;
...
}
...
default listbox
{
...
.font FixedFont;
.posraster true;
.sizeraster true;
...
}
...
default poptext
{
...
.font PropFont;
.posraster true;
.sizeraster true;
...
}
...
default groupbox
{
...
.reffont RefFont;
.posraster true;
.sizeraster true;
...
}
...
default pushbutton
{
...
.font PropFont;
.posraster true;
.sizeraster true;
...
}
...
default radiobutton
{
...
.font PropFont;
.posraster true;
.sizeraster true;
...
}
...
default statictext
{
...
.font PropFont;
.posraster true;
.sizeraster true;
...
}
...
default tablefield
{
...
.reffont RefFont;
.font PropFont;
.posraster true;
.sizeraster true;
...
}
...
default window
{
...
.reffont RefFont;
.font PropFont;
.posraster false;
.sizeraster true;
...
}
|
|