Kbase 21953: How To Prevent Error 4499 From Happening At Runtime
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  4/10/2002 |
|
SUMMARY:
You might experience error (4499) when trying to make use of a font type that is not properly set in the current environment of your Progress application:
**Font <font-number> not in Font Set. (4499)
The sample program given below avoids the error by searching the application environment for a particular key that sets a value for the desired font.
SOLUTION:
This example program runs against the Progress sports2000 sample database. Basically, it avoids error 4499 by defining a function, isFontSet, that searches the current application environment for a particular key containing the value of a desired font. It returns true or false depending upon the result of the search. If the value for the desired font is not present in the current application environment, then the program displays an information message. The message states that the specified font is not properly set in the current application defaults, consequently it does not make use of that font, and so avoids the runtime error.
FUNCTION isFontSet RETURNS LOGICAL
(piFontNumber AS INTEGER /* parameter-definitions */ ) FORWARD.
DEFINE QUERY custBrowser FOR
Customer SCROLLING.
DEFINE BROWSE custBrowser
QUERY custBrowser NO-LOCK DISPLAY
Customer.CustNum FORMAT ">>>>9":U
Customer.Name FORMAT "x(30)":U
Customer.Contact FORMAT "x(30)":U
WITH NO-ROW-MARKERS SEPARATORS SIZE 62 BY 5.71 EXPANDABLE.
DEFINE FRAME DEFAULT-FRAME
custBrowser AT ROW 4.33 COL 10
WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
SIDE-LABELS NO-UNDERLINE THREE-D
AT COL 1 ROW 1
SIZE 80 BY 16.
DEFINE VARIABLE viFontNumber AS INTEGER LABEL "Font Number":U NO-UNDO.
UPDATE viFontNumber WITH VIEW-AS DIALOG-BOX SIDE-LABELS
TITLE "Font to be assigned to Customer Browser":U WIDTH 55.
IF viFontNumber = ? THEN
RETURN.
IF isFontSet(viFontNumber) THEN
ASSIGN BROWSE custBrowser:FONT = viFontNumber.
ELSE
MESSAGE "Cannot assign font#":U viFontNumber
"to browse widget because that ~n":U
"particular font is not properly set":U
"in the current environment!":U
VIEW-AS ALERT-BOX INFO BUTTONS OK.
ASSIGN
BROWSE custBrowser:TITLE = "Customer Browser displayed with ":U +
IF isFontSet(viFontNumber) THEN
"Font# ":U + STRING(viFontNumber)
ELSE
"default font":U.
ENABLE ALL WITH FRAME DEFAULT-FRAME.
OPEN QUERY custBrowser FOR EACH Customer NO-LOCK INDEXED-REPOSITION.
WAIT-FOR CLOSE OF THIS-PROCEDURE.
FUNCTION isFontSet RETURNS LOGICAL
(piFontNumber AS INTEGER /* the number of the font to be checked */):
/*---------------------------------------------------------------
Purpose: Returns whether or not a specific font is properly
set in the current application defaults (environment).
Notes:
---------------------------------------------------------------*/
DEFINE VARIABLE vcFontValue AS CHARACTER NO-UNDO.
REPEAT piFontNumber = piFontNumber TO 0 BY -1:
GET-KEY-VALUE SECTION "fonts":U
KEY ("font":U + STRING(piFontNumber))
VALUE vcFontValue.
IF vcFontValue = ? THEN
LEAVE.
END.
RETURN vcFontValue <> ?. /* Function return value. */
END FUNCTION.
References to Written Documentation:
Progress Knowledge Base Solution 18493, "How to Implement the LOAD and USE Statements for FONTS"