Specifying the Font

Description

In this example we will show how font owner-draw specifications can be used to control the font of the data in a list box.

Consider the script below. We define two variables, "font1" which is the font directive to select Arial, 8 point, normal, and "font2" which selects Arial, 8 point, bold. In row 1 of the data, the word "Boston" is prefixed with "font2" which turns bold on, and is suffixed with "font1" which turns bold off. This will cause "Boston" to be displayed in bold on row 1, but not row 2 and 3. In row 4 of the data, the string "New York" is prefixed with "font2" and suffixed with "font1". This will cause "New York" to be displayed in bold.

tab1 = "{T=1}"
tab2 = "{T=2}"
font2 = "{F=Arial,8,B}"
font1 = "{F=Arial,8}"
data = font2+"Boston"+font1+tab1+"Red Sox"+tab2+"Baseball" + crlf()+\
       "Boston"+tab1+"Celtics"+tab2+"Basketball" + crlf()+\
       "Boston"+tab1+"Patriots"+tab2+"Football" + crlf()+\
       font2+"New York"+font1+tab1+"Yankees"+tab2+"Baseball" + crlf()
ui_dlg_box("Columns",<<%dlg%
[%O={@@}%.80,10data_selected^#data];
{lf};
[.80data_selected];
%dlg%)

This script produces this dialog:

images/XD_Specifying the font for data.gif

Limitations

Desktop applications only

See Also