Quote:
> I am developing an application in Smalltalk Express 2.0.4, using Window
> Builder. The development environment is a PC with Windows NT, with a
> 17" screen and a resolution of 1024x768. The application however must
> run on a PC with a standard VGA screen (640x480).
> If I design the WB window with the high resolution screen and then I
> port the image on the VGA PC, it is automatically rescaled and I cannot
> obtain a good result (the widgets change relative positions and
> dimensions and overlap).
> Using the VGA PC to design the window is not practical. In the
> manuals I was not able to find an answer to my problem, wich is:
> how to fix the main window and widget dimensions and relative
> positions, porting the application to screens of smaller resolutions?
Generally moving from one screen resolution to another isn't a problem
as long as you use the same system fonts. I move between 640x480,
800x600, and 1024x768 without a problem. The place that problems can
appear is in the use of different system fonts on different resolutions
(e.g., "Small fonts" under 640x480 & 800x600 and "Large fonts" under
1024X768). Since all layouts are done in terms of dialog units which are
proportional to the current system font, you can have a problem when the
system fonts at different resolutions have different metrics associated
with them. Likewise, hard coding a reference to 8 point Helvetica under
"Small fonts" may look just fine. Under "Large fonts" this would be way
to small.
Here are some strategies for dealing with the issue:
1) Only use the System font when laying out windows. Account for the
small changes in font metrics by adjusting the horizontal sizes of
controls +10-20%. For example, right justify all StaticText labels and
add 20% to their widths on the left side. That will provide enough
growing room and will keep the label from being clipped.
2) Use multiple fonts with multiple resolutions stored in appropriate
globals. In the #preInitWindow method for your ViewManagers, you can
dynamically set the fonts based on the screen resolution you are working
on. Something like this:
during startup:
if screen size > 800x600 then
MasterFont := LargeFont
else
MasterFont := SmallFont
then in #preInitWindow:
preInitWindow
self mainView children do: [ :child | child font:
MasterFont ]
3) If your users are only on 640x480 or 800x600 this would generally
imply small system fonts. Have your developers under 1024x768 use small
system fonts as well. It will make the menu bar appear smaller, but you
will be using the same scale and font metrics as your target
environment. Then you can pretty much do what you want.
4) Not recommended but can work on occasion: Create multiple screen
layouts for different resolutions and trigger the one that is
appropriate at runtime.
Some combination of the above techniques should work well (#3 is
probably the easiest to deal with).
As far as window sizes are concerned. If your users will be using
640x480, then make sure that none of your windows is larger than that.
It would probably be a good idea to have at least one of your
development machines set to 640x480 so that you can test your windows
throughout the development process.
-Eric Clayberg
President
Smalltalk Systems (StS), a division of Instantiations, Inc.
Web: http://www.smalltalksystems.com
http://www.instantiations.com
GO SMALLTALK!