Release 10.1A: OpenEdge Development:
Programming Interfaces

> ## Font dialog box example

> The `i-fdial1.p` procedure opens the dialog box that allows you to separately change the font of either its radio set or buttons to a custom font:

> i-fdial1.p
>     IF FONT-TABLE:NUM-ENTRIES < 13 THEN
>          FONT-TABLE:NUM-ENTRIES = 13.

>     DEFINE VARIABLE RadioFont  AS INTEGER INITIAL 11.
>     DEFINE VARIABLE ButtonFont AS INTEGER INITIAL 12.
>     DEFINE VARIABLE FontSelect AS INTEGER INITIAL 11
>         VIEW-AS RADIO-SET
>             RADIO-BUTTONS "Radio Font", 11, "Button Font", 12
>             FONT RadioFont.
>     DEFINE BUTTON bOK          LABEL "OK" FONT ButtonFont.
>     DEFINE BUTTON bCANCEL  LABEL "CANCEL" FONT ButtonFont.

>     FORM
>         SKIP(0.5) SPACE(0.5)
>         FontSelect SPACE(2) bOK SPACE(2) bCANCEL
>         SPACE(0.5) SKIP(0.5)
>         WITH FRAME fFont TITLE "Choose frame fonts ..."
>              VIEW-AS DIALOG-BOX.

>     ON CHOOSE OF bOK IN FRAME fFont
>     DO:
>         ASSIGN FontSelect.
>         SYSTEM-DIALOG FONT FontSelect.
>     END.

>     ON CHOOSE OF bCANCEL IN FRAME fFont STOP.

>     ENABLE FontSelect bOK bCANCEL WITH FRAME fFont.

>     WAIT-FOR WINDOW-CLOSE OF FRAME fFont.

> When you run this procedure on Windows, the following dialog box appears:

> When you run the procedure, the radio set displays in the default MS Sans Serif font and buttons display in the default Courier New font. To change a font, choose the Radio Font (font 11) or Button Font (font 12) radio item, then choose or click the OK button to open the font dialog box shown in Figure 6–2. Choosing (or clicking) CANCEL terminates the procedure without any further font changes.

> To change the radio-set font selected in Figure 6–2 to bold 8-point Arial, set up the font dialog as shown in Figure 6–3.

> Figure 6–3: Changing font 11 to bold 8-point Arial

> After you choose OK, the Choose frame fonts dialog box reappears with the radio set in the new font:

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095