llError = !thisform.WriteBuffer()
Just before you actually save.if TYPE("_screen.activeform") == "O" and UPPER(_screen.activeform.BaseClass) = "FORM" lError = WriteBuffer(_screen.activeform) ... code for saving endif Function WriteBuffer LParameter toForm LOCAL llRetval llRetVal = .T. *-- Code to save field value to buffer when *-- clicking on toolbar without leaving the field *-- Don't do this for a grid since a grid may change *-- work areas unexpectedly IF TYPE("toForm.ActiveControl") == "O" AND ; UPPER(toForm.ActiveControl.BaseClass) <> "GRID" IF TYPE("toForm.ActiveControl.ControlSource") <> "U" AND ; !EMPTY(toForm.ActiveControl.ControlSource) IF EVAL(toForm.ActiveControl.ControlSource) <> toForm.ActiveControl.Value REPLACE (toForm.ActiveControl.ControlSource) WITH toForm.ActiveControl.Value *-- We rely on the fact that we revert the field's value *-- in the error event method for the form. llRetVal = (EVAL(toForm.ActiveControl.ControlSource) = toForm.ActiveControl.Value) ENDIF ENDIF ENDIF RETURN llRetVal
LOCAL llRetval >>llRetVal = .T. >> >>*-- Code to save field value to buffer when >>*-- clicking on toolbar without leaving the field >>*-- Don't do this for a grid since a grid may change >>*-- work areas unexpectedly >>IF TYPE("thisform.ActiveControl") == "O" AND ; >> UPPER(thisform.ActiveControl.BaseClass) <> "GRID" >> IF TYPE("thisform.ActiveControl.ControlSource") <> "U" AND ; >> !EMPTY(thisform.ActiveControl.ControlSource) >> IF EVAL(thisform.ActiveControl.ControlSource) <> thisform.ActiveControl.Value >> REPLACE (thisform.ActiveControl.ControlSource) WITH thisform.ActiveControl.Value >> *-- We rely on the fact that we revert the field's value >> *-- in the error event method for the form. >> llRetVal = (EVAL(thisform.ActiveControl.ControlSource) = thisform.ActiveControl.Value) >> ENDIF >> ENDIF >>ENDIF >> >>RETURN llRetVal