Consultor Eletrônico



Kbase P11353: 4GL: how to change a multiple line column label in a DOWN FR
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   3/12/2003
Status: Unverified

GOAL:

How to change a multiple line column label in a DOWN FRAME

FACT(s) (Environment):

Progress 8.x

FACT(s) (Environment):

Progress 9.x

FIX:

When you set a column label in more than one line Progress stores just the value of the first line in the default label handle. The second line is stored in another (hidden) handle.
So by doing:

FORM i COLUMN-LABEL "Line One !Line two "

The label displayed will be
Line ONE
Line TWO

but if you try to change it by doing

i:LABEL IN FRAME a = "Changed ONE! Changed TWO".

The label displayed will be
Changed ONE! Changed TWO
Line TWO

So if you try to change dinamically the label you have to store the handle that contains the second part of the label.

One way to store the second line handle is to store it when you initially set the label by searching into the field group for the second line value. And so when handle that is equal to "second line" is found it is possible to save it.

Here is a sample code:

DEFINE VARIABLE secondLine AS HANDLE NO-UNDO.
DEFINE VARIABLE g AS HANDLE NO-UNDO.

DEFINE VARIABLE var i AS INT NO-UNDO.

FORM i COLUMN-LABEL "Line One !Line two "
WITH FRAME a DOWN WIDTH 40.

VIEW FRAME a.
DOWN WITH FRAME a.

g = FRAME a:LAST-CHILD. /*field group for the labels*/
secondLine = g:FIRST-CHILD.
DO WHILE secondLine <> ?:
IF secondLine:SCREEN-VALUE = "Line two" THEN
/*if the second part is equal to what we already know
we save the handle to be able to change it later */
LEAVE.
secondLine = secondLine:NEXT-SIBLING. /*if not we look for the next...*/
END.

/* Now secondline contains the second line label so it is possible
to change it in any moment*/


/* the first line is stored by progress in the default label*/
/* the second line is stored in our label*/

/*Changing the label*/

i:LABEL IN FRAME a = "Changed ONE".
secondLine:SCREEN-VALUE = "Changed TWO".

REPEAT WITH FRAME a:
UPDATE i.
END.