Consultor Eletrônico



Kbase 18493: How To Implement The LOAD And USE Statements For FONTS
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/15/2008
Status: Verified

GOAL:

How to effect font changes 'on the fly' using the 4GL statements, LOAD and USE.

FACT(s) (Environment):

Progress 8.x

FIX:

With LOAD and USE, it is possible to start your Progress session with one font setting, and then change it during the same session.

1) Make sure that your progress.ini (or the ini file that you    use to start progress) contains a font definition for the font that you are later going to change.  In this Knowledge Base example we set font9 to Times New Roman initially, so in the  progress.ini we have font definitions for fonts 0 thru 9.
You may not omit font numbers in the sequence font0 through fontN.  That is, even if you will not be using font8, it still needs to be defined if the .ini file also contains a definition for font9.


Font9=Times New Roman, size=10

2) In a separate .ini file (which we will call font9.ini in our example) you have to have a [fonts] section just like in the progress.ini.  This means you have to have fonts 0 thru 9 defined even though the only definition you are going to change is for font9.  This is because progress stops reading fonts if it detects a break in the sequence numbers. Change the font9 definition to Courier New with this setting.


Font9=Courier New, size=10

3) In your code, issue a LOAD statement for the new .ini file and then a USE statement for the .ini file.  Keep in mind that the new font settings will only work for newly created windows -- those created after the USE statement executes. Displayed fonts will not change for windows opened prior to the USE statement executing.

This is currently logged as enhancement request # 19981217-023.

The code might look like this:

DEFINE VARIABLE w1 AS CHARACTER VIEW-AS TEXT FONT 9 FORMAT "x(34)"
   INITIAL "This is font 9 in the default window".
DEFINE VARIABLE w2 AS CHARACTER VIEW-AS TEXT FONT 9 FORMAT "x(34)"
   INITIAL "This is font 9 in the first child window".
DEFINE VARIABLE new_win1 AS WIDGET-HANDLE.

LOAD "font9.ini".

/* note the font will be set to Times New Roman which is what you started the session with */

DISPLAY w1 WITH NO-LABELS WITH FRAME a.
PAUSE.

USE "font9.ini".
CREATE WINDOW new_win1.
CURRENT-WINDOW = new_win1.

/* Now, the font will be Courier New which is what you specified
in the font9.ini file */
DISPLAY w2 in WINDOW new_win1 WITH NO-LABELS WITH FRAME b.
PAUSE.

DELETE WIDGET new_win1.

UNLOAD "font9.ini".