PreviousTutorial - Using Bitmaps to Change the Mouse Pointer

Appendix A: Fonts and Colors

This appendix looks at how you can use different fonts and colors. You might want to change the appearance of your interface to:

Using different fonts and colors can greatly enhance your interface. However, using too many different fonts can make a screen look messy and it is advisable to use no more than three colors on any screen.

A.1 Setting Fonts

A font is a set of characters having common visual characteristics. You can use a different font to give the interface a more distinctive look. For example, you can use a monospaced font to ensure that parts of the interface line up neatly.

You can also use a different font to draw the user's attention to a specific part of the interface. For example, you can highlight a parameter in a text string by making the parameter a different font from the surrounding text. The following text illustrates this feature:

In the dialog fragment, large-entry-field is the data item associated with the MLE.

The size of the text (its pointsize) is another way to highlight a specific component of the interface. In the preceding example, you could make the type used for the filename a larger pointsize, for example 12 point instead of 10 point. This would also draw the user's attention to the filename.

You can set fonts at definition time only. No Dialog System functions are available to change any of the font definitions. However, you can dynamically change fonts using Panels V2. The chapter Using Panels V2 describes how to call Panels V2 from your Dialog System program.

See the topic Dialog System Overview in the Help for a description of setting fonts.

A.2 Setting Colors

You can change the foreground and background colors of objects either at definition time, using the Color menu choice on the Edit menu or clicking on the edit color toolbar icon, or dynamically, using the SET-COLOR function.

For example, the following dialog fragment changes the color of a field with validation errors to 'WHITE' (foreground color) on 'RED' (background color). Remember that when Dialog System detects a validation error, the identifier of the field in error is placed in $EVENT-DATA.


Generic colors are available for all environments. Also, each environment has a list of additional colors that you can select. If you are developing cross-platform applications, check to make sure the colors you are using are supported on all environments.

To set the color of an object back to its default values, use the value of $NULL for the foreground and background colors:


For further information on the SET-COLOR function and lists of available colors, see the topic Dialog Statements: Functions in the Help.

Copyright © 2000 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousTutorial - Using Bitmaps to Change the Mouse Pointer