Designing Applications for Graphical and Text Environments

If an application is to run on both Windows and text-based environments, it can be built using the following methods:

When a 5.x window or form is brought into the Screen Painter and the Coordinate system is set to Text, its twip values are converted to appropriate row and column character cells. If the window or form is saved, only its row and column character cell values are written back. Zim Graphical for Text-based systems uses the character cell values of a widget if they are present.

Once a window or form contains both character cell and twip values, the Screen Painter in Text Coordinates mode uses only the character cell values (and graphical mode uses only the twip values). Thus a form can contain two sets of unrelated positions and dimensions: those used in an MS-Windows environment and those used in text-based environments.

Note: Sometimes, a 5.x window or form contains character cell dimensions that are no longer in use. The row, col, wdth, and hght fields can contain invalid values that cause the text-based version of Zim Graphical to display the widget inappropriately. When this is the case, the Screen Painter's coordinates menu provides an option to Adapt Text from Graphical; this option is equivalent to setting the row, col, wdth, and hght fields to $null so that the Screen Painter's Text Mode can initialize them to appropriate values.

In a similar vein, if a widget contains both an RGB and a standard Zim color number, the Windows version of Zim uses the RGB value while the text-based version uses the standard Zim color number.

The first time a graphical form is brought into the Screen Painter in Text Mode, the Painter attempts to choose appropriate character cell positions and dimensions but tailoring is usually required. For example, converting variable pitch fonts to fixed pitch sometimes causes the text of a widget to appear truncated, as fewer fixed pitch characters fit within the widget.