Consultor Eletrônico



Kbase P90817: How to prevent a user from modifying the value of a specific row in an editable browse widget?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   2/9/2006
Status: Verified

GOAL:

How to prevent a user from modifying the value of a specific row in an editable browse widget?

GOAL:

How to make an updateable browse row read-only?

GOAL:

How to lock a particular record in a browse so that it is no longer editable?

FIX:

In order to prevent a user from editing the value of a specific browse row, set the READ-ONLY attribute of the updateable browse columns to TRUE every time the user selects the row that should not be modified. e.g.:

ON VALUE-CHANGED OF BROWSE-1 IN FRAME DEFAULT-FRAME /* Browse 1 */
DO:
RUN setReadOnly
(IF {&BROWSE-NAME}:FOCUSED-ROW = 5 /* Application specific logic */ THEN
TRUE
ELSE
FALSE).
END.

PROCEDURE setReadOnly:
DEFINE INPUT PARAMETER pLog AS LOGICAL NO-UNDO.

DEFINE VARIABLE vhObjHdl AS HANDLE NO-UNDO.

vhObjHdl = BROWSE {&BROWSE-NAME}:FIRST-COLUMN.

DO WHILE VALID-HANDLE(vhObjHdl):
vhObjHdl:READ-ONLY = pLog.
vhObjHdl = vhObjHdl:NEXT-COLUMN.
END.
END PROCEDURE.