Consultor Eletrônico



Kbase P57846: How do I make Progress size the columns by taking the maximum ofeither the labels or the column fiel
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   07/07/2005
Status: Unverified

GOAL:

How do I make Progress size the browse columns by taking the maximum of
either the labels or the column field itself?

FACT(s) (Environment):

Windows

FIX:

The following code loops through the columns of the browse making the width of each the maximum of either the label width or the column width adding the resulting width to the browse width which is initialized at 2 units:
DO:
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE h AS HANDLE NO-UNDO.
DEFINE VARIABLE c AS CHARACTER NO-UNDO.


BROWSE-2:WIDTH-CHARS = 2.
h = BROWSE-2:FIRST-COLUMN IN FRAME {&FRAME-NAME}.
DO i = 1 TO BROWSE-2:NUM-COLUMNS:
c = h:LABEL.
h:WIDTH-CHARS = MAXIMUM(FONT-TABLE:GET-TEXT-WIDTH-CHARS(TRIM(c),7) ,
h:WIDTH-CHAR).
BROWSE-2:WIDTH-CHARS = BROWSE-2:WIDTH-CHARS + h:WIDTH-CHARS.
h = h:NEXT-COLUMN.
END.
END.