Assigning colors and fonts to a widget
- Last Updated: October 17, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
You can assign colors and fonts to a widget either in
the widget definition statement or at runtime after the widget is
displayed. Use the FGCOLOR, BGCOLOR, DCOLOR, PFCOLOR,
and FONT options at definition time and the FGCOLOR, BGCOLOR, DCOLOR, PFCOLOR,
and FONT attributes at runtime.
ABL uses the foreground color you specify for any values that appear in the widget; ABL uses the background color for the area around the widget values.
ABL uses the font you specify for any text that appears within the widget.
Note that FGCOLOR, BGCOLOR, and FONT apply
to graphical interfaces only, and DCOLOR and PFCOLOR apply
to character interfaces only. For more information on specifying
color in character interfaces, see Color in character interfaces.
The i-clrfnt.p procedure demonstrates how to initialize colors and fonts at widget definition and how to change them dynamically at runtime.
i-clrfnt.p
|
This procedure creates three sliders representing foreground
color, background color, and font. The maximum value of each slider
is determined by examining the NUM–ENTRIES attributes
of the COLOR–TABLE and FONT–TABLE system
handles. As you move the appropriate trackbar, the foreground color, background
color, or font of the interface changes. Note that, because the
procedure does not explicitly set the size of any of the sliders,
the ABL Virtual Machine (AVM) resizes them at runtime as you change
the font.
You can assign colors and fonts to all widgets, with the following exceptions:
- In Windows, to assign colors to buttons, menus, and window titles, you must use the Display Properties dialog box in the Control Panel. You cannot change these colors in your OpenEdge application.
- In all environments, images and rectangles have no text and, therefore, cannot take a font assignment.
For more information on the COLOR–TABLE and FONT–TABLE handles,
and on the FGCOLOR, BGCOLOR, DCOLOR, PFCOLOR,
and FONT options and attributes, see
ABL Reference. For more information on using
the COLOR–TABLE and FONT–TABLE handles
for run-time color and font management, see Accessing the current color and font tables.