Changing part colors and fonts
Another enhancement that you can make to your visual parts is to change the colors and fonts that the parts use.
If you are developing applications to be used on multiple platforms, you should carefully consider the effect of choosing colors and fonts that are different from the default system colors and fonts. For example, if you chose a particular font available in Linux, that font might not be available in Windows. For more information, see
Portability of colors and fonts.
Change the color of a part
1. In the Composition Editor, from the Options pull-down menu, select Colors.
The Colors window opens:
2. In the Colors window, click mouse button 1 on the color you want to use.
When the mouse pointer is moved over a valid location in the Composition Editor, the pointer will change to a spray paint can, indicating it is loaded with a color. The name of the color selected is displayed in the Color Name drop-down list near the bottom of the Colors window.
3. Click mouse button 1 on the part you want to change.
Note:
You cannot change the color of Menu parts, or parts in Menu parts. You cannot change the color of connections using this window. To change the connection color, use the Connections tab of the Preferences window.
4. From the pop-up menu that displays, select the particular attribute of the part, such as backgroundColor, you want to change.
The backgroundColor attribute specifies the color of the part's background and the foregroundColor attribute specifies the color of text and borders.
5. When you are done using the Colors window, you can close it by double-clicking on the system menu icon in the upper left corner.
You may also change a part's foreground or background color by bringing up the properties window for that part and editing the foregroundColor or backgroundColor property values.
For Windows:
If Sticky is selected in the Composition Editor, the color selection remains loaded for your convenience. To set a part foreground or background color back to its default, select the Default push button in the Colors window then select the part you wish to change.
To unload the mouse pointer at any time, select the selection tool
from the tool bar.
Change the font of a part
1. In the Composition Editor, from the Options pull-down menu, select Fonts.
The Font Selection window opens:
2. Using the Foundry, Family, and Charset drop-down lists, select the font you want to use. An asterisk (*) means use any value.
The bottom left corner of the window indicates whether the selected font is a bitmap or scaled font.
3. Using the Style, Ext. Style, and Size drop-down lists, select the style and size you want to use.
A sample of the font you have selected is displayed in the text area. You can type additional text in this area to try out different characters.
4. When you are done specifying the font, select OK.
When the mouse pointer is moved over a valid location in the Composition Editor, the pointer changes to a pencil, indicating it is loaded with a font.
5. Click mouse button 1 on the part you want to change.
Note:
You cannot change the font of Menu parts, or parts in Menu parts.
If the part has more than one font attribute that you can change, a pop-up menu is displayed. In the pop-up menu, select the particular attribute whose font you want to change.
You may also change a part's font by bring up the properties window for that part and editing the fontName property value.
For Windows:
If Sticky is selected in the Composition Editor prior to displaying the Font Selection window, the font remains loaded for your convenience. To set a part's font back to its default setting, select the Default push button in the Font Selection window then select the part you wish to change
To unload the mouse pointer at any time, select the selection tool
from the tool bar.
Portability of colors and fonts
If your application will be used on multiple platforms, the colors and fonts of the parts must be available on all systems that will run your application.
If you do decide to change the colors of parts in your application, use only the basic colors on the Colors window, because nonbasic colors can appear differently on different platforms.
For systems with different fonts installed, make sure the fonts you choose are available on all systems that will run your application. For example, since the OS/2 system proportional font displays double-byte characters as blanks, you should not choose this font if you need to support double-byte character sets. You might also have problems with certain fonts if your application will be run with different code pages.
For more information related to changing a part's font and color, refer to the section on changing a part's design, in the chapter on adding a user interface in the How Do I.