/* Imagine the customer table contains snapshots of records before & after some user has made some changes. */ DEF BUFFER b1 FOR customer. DEF BUFFER b2 FOR customer. DEF VAR i-handle AS HANDLE. DEF VAR h-handle AS HANDLE. DEF VAR color-label AS CHAR NO-UNDO. DEF STREAM null-stream. /* find the two records to be compared */ FIND FIRST b1 NO-LOCK. FIND LAST b2 NO-LOCK. /* display the records in a non-displayed frame */ IF OPSYS = "unix":U THEN OUTPUT STREAM null-stream TO /dev/null . ELSE IF CAN-DO("WINDOW*,MS*,DOS":U,OPSYS) THEN OUTPUT STREAM null-stream TO NUL. DISP STREAM null-stream b1 WITH FRAME f-before SIDE-LABELS NO-BOX. DISP STREAM null-stream b2 WITH FRAME f-after SIDE-LABELS NO-BOX. OUTPUT STREAM null-stream CLOSE. /* start walking the widget tree */ ASSIGN i-handle = FRAME f-before:HANDLE i-handle = i-handle:FIRST-CHILD i-handle = i-handle:FIRST-CHILD h-handle = FRAME f-after:HANDLE h-handle = h-handle:FIRST-CHILD h-handle = h-handle:FIRST-CHILD . /* compare and display differences */ REPEAT WITH FRAME f-audit 10 DOWN CENTERED ROW 5 TITLE " Changed Data " OVERLAY. IF i-handle:NAME <> ? THEN DO: IF i-handle:SCREEN-VALUE <> h-handle:SCREEN-VALUE THEN DO: color-label = " " + i-handle:LABEL. DISP color-label FORMAT "x(14)" NO-LABEL /* i:name format "x(20)" */ i-handle:SCREEN-VALUE FORMAT "x(30)" LABEL "Changed From" h-handle:SCREEN-VALUE FORMAT "x(30)" LABEL "Changed To". COLOR DISPLAY messages color-label. END. END. IF i-handle:NEXT-SIBLING = ? THEN LEAVE. ASSIGN i-handle = i-handle:NEXT-SIBLING h-handle = h-handle:NEXT-SIBLING. END. PAUSE. HIDE FRAME f-audit NO-PAUSE.