Consultor Eletrônico



Kbase P120847: 4GL: How to prevent the user from updating a browse field based on the value of another?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   30/11/2006
Status: Unverified

GOAL:

4GL: How to prevent the user from updating a browse field based on the value of another?

GOAL:

How to set the READ-ONLY attribute of a browse column based on the value of another?

FIX:

Create a ROW-ENTRY trigger for the browse and use the GET-BROWSE-COLUMN() method of the browse to get the handle to the updatable field and set its COLUMN-READ-ONLY attribute to TRUE when the condition is met. For example, the following ROW-ENTRY trigger prevents the user from updating the City field when the CustNum is even. The example assumes that the City column in this case is the second column of the browse:
ON ROW-ENTRY OF BROWSE-1 IN FRAME DEFAULT-FRAME DO:
DEFINE VARIABLE hColumn AS HANDLE NO-UNDO.
hColumn = BROWSE BROWSE-1:GET-BROWSE-COLUMN(2).
IF Customer.CustNum MODULO 2 = 0 THEN
hColumn:COLUMN-READ-ONLY = TRUE.
ELSE
hColumn:COLUMN-READ-ONLY = FALSE.
END.