Control Size Problems from Win16 to Win32

Article ID: 894
Last updated: 05 Feb, 2008
Article ID: 894
Last updated: 05 Feb, 2008
Revision: 1
Views: 3055
Posted: 29 Aug, 1997
by Dean J.
Updated: 05 Feb, 2008
by Dean J.
Problem


Control sizes are different when I design a dialog in zApp Factory in Win16, save the project, then take it to Win32.


Cause


The problem begins on the Win16 side. When you first begin designing your dialog you will notice that Factory says it is using a Helv, 8 font. This is the font used when determining control sizes. This is incorrect. By default there is no Helv 8 on Win16 and being that the font does not exists, Windows will use MS Sans Serif, 8. However when the .apd is brought over to Win32 and built there is a Helv 8 and Win32 will use that font for sizing. There you will notice a big difference.

On Win 16 it not only uses MS Sans Serif, but also sets the font weight to the default, BOLD. This causes another problem. For one, Win 32 will use the NORMAL weighted MS Sans Serif font for sizing when the Win16 side used BOLD version for sizing. The biggest problem with doing this however is if you assign a BOLD font to the Dialog, Font weights are NOT used for the DIALOG PORTION of resources, they are however used in resources regarding controls but not dialogs. Therefore if you set the Font weight to BOLD a font weight of NORMAL will be assumed when reading in the resource header.


Action


The easiest solution is to set the dialog font to MS Sans Serif, 8, Normal (or whatever normal-weight font you want to use) when designing your dialogs on Win16. Be sure the font you are using exists as well on Win32.

You may also have the whole application layout done on Win16 already and it would be too much work to realign every dialog with the new font settings. If this is the case you can add this line to your Win32 application's MainWindow constructor.

zAppGetAppVar(app)->setDefaultDlgFontWeight(FW_BOLD);

When the DIALOG font is read in from the resource file, and it creates the Font, it will use a font weight of BOLD instead of NORMAL. This is OK since this is was the font weight used on WIN16.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 894
Last updated: 05 Feb, 2008
Revision: 1
Views: 3055
Posted: 29 Aug, 1997 by Dean J.
Updated: 05 Feb, 2008 by Dean J.

Others in this category