How to use font after creating it at runtime

patelspam

New Member
Hey guys. The problem is pretty simple. I'm trying to use a font after creating and i keep getting the same error and i don't know why:
1711127085553.png
Can anyone spot the error in the following code?
Code:
    DEFINE TEMP-TABLE tt-test NO-UNDO
    FIELD oui AS CHAR
    FIELD croissant AS CHAR.
    
    CREATE tt-test.
    ASSIGN
        tt-test.oui          = "2"
        tt-test.croissant = "3"
        .
    
    DEFINE FRAME cust-bal
      tt-test.oui
      tt-test.croissant
      WITH CENTERED ROW 3 TITLE "hon hon hon" USE-TEXT.
    
    FOR FIRST tt-test NO-LOCK WITH FRAME cust-bal:
      DISPLAY
      tt-test.oui
      tt-test.croissant  .
    END.
        DEFINE VARIABLE i-FontIndex AS INTEGER     NO-UNDO INITIAL 249.
        PUT-KEY-VALUE SECTION "fonts":U KEY "font":U + STRING(i-FontIndex) VALUE("Arial, size=32") NO-ERROR.
        FONT-TABLE:NUM-ENTRIES = i-FontIndex.
        MESSAGE 1
        SKIP FONT-TABLE:NUM-ENTRIES
            VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.
        FRAME cust-bal:FONT =  FONT-TABLE:NUM-ENTRIES.

Note: I asked the same question in a different site (Progress Customer Community)
 

patelspam

New Member
Do you know how to use .ini file to set fonts in it? When you start your progress session, you can use -ini startup parameter and reference the xxxxx.ini file. Checkout below link.

Hi there! Yes i do, my ini file has 248 fonts and in the code that it's in the post, i'm trying to create a new one (number 249) and use it at runtime. The problem is i can only do that if i re-start my session (after creating said font). But i don't want to re-start my session. I'm trying to see if there's a way around that problem...
 

Osborne

Active Member
The only options I know of is as per this article:


Or something similar to this very old code snippet from many years ago:

Code:
DEFINE VARIABLE Font1 AS INTEGER INITIAL 1.
DEFINE VARIABLE Font2 AS INTEGER INITIAL 2.
DEFINE VARIABLE FontSelect AS INTEGER INITIAL 1
   VIEW-AS RADIO-SET RADIO-BUTTONS "Font 1", 1, "Font 2", 2 FONT Font1.

DEFINE BUTTON bOK LABEL "OK" FONT Font2.
DEFINE BUTTON bCANCEL LABEL "Cancel" FONT Font2 AUTO-ENDKEY.

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:
   IF INTEGER(FontSelect:SCREEN-VALUE IN FRAME fFont) = Font1 THEN
      SYSTEM-DIALOG FONT Font1.
   ELSE
      SYSTEM-DIALOG FONT Font2.
END.

UPDATE FontSelect bOK bCANCEL WITH FRAME fFont.
 
Top