Consultor Eletrônico



Kbase P13034: Right -align in Appbuilder for fillin fields, does not right justify
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/15/2008
Status: Verified

SYMPTOM(s):

Highlighting and Choosing right-align in the Appbuilder for fill-in fields does not right align the fill-in fields

The text in the fill-in field can not be right justified.

CAUSE:

The Right-Align property for fill-in fields in the AppBuilder applies to the fill-in widget only.  This property is used for visualization of the widget.  It does not apply to character data displayed within it.

FIX:

There is no function in PROGRESS language that will right justify a character field, however a 1 line function can be written to do this when using a fixed font. This will not work with a proportional font.

It is done by padding the left side of the character field with the right number of blanks to push the string to the right.

To right justify a display field of 20 characters:


DEFINE VARIABLE blanks AS CHARACTER FORMAT "x(20)" NO-UNDO.
DEFINE VARIABLE a AS CHARACTER FORMAT "x(15)" NO-UNDO.

ASSIGN blanks = FILL("",20). /* starting with a string of 20 blanks */
OUTPUT TO file-a.txt.

ASSIGN a = "THIS"
a = SUBSTRING(blanks,1,(20 - LENGTH(a))) + a.
PUT a FORMAT "X(20)" SKIP.

ASSIGN a = "WILL"
a = SUBSTRING(blanks,1,(20 - LENGTH(a))) + a.
PUT a FORMAT "X(20)" SKIP.

ASSIGN a = "RIGHT"
a = SUBSTRING(blanks,1,(20 - LENGTH(a))) + a.
PUT a FORMAT "X(20)" SKIP.

ASSIGN a = "JUSTIFY"
a = SUBSTRING(blanks,1,(20 - LENGTH(a))) + a.
PUT a FORMAT "X(20)" SKIP.

OUTPUT TO CLOSE.

The output file (file-a) will contain the following:


               THIS
               WILL
              RIGHT
            JUSTIFY