ChrisJRutter
Member
Can anyone help me here, I'm new to the whole persistent thing....
I have a persistent procedure that adds or updates a record:
ON CLOSE OF THIS-PROCEDURE
DO:
... check any widgets have been modified
... if any have then ask the user if they want to cancel their changes
RUN disable_UI.
END.
MAIN-BLOCK: DO TRANSACTION ON ERROR UNDO, LEAVE
ON END-KEY UNDO, LEAVE:
.... create or find record EXCLUSIVE-LOCK.
.... various fields enabled for input
.... buttons bu_save and bu_cancel are also present
RUN enable_UI.
IF NOT THIS-PROCEDURE
ERSISTENT THEN
WAIT-FOR CLOSE OF THIS-PROCEDURE OR CHOOSE OF bu_cancel.
END.
My questions is; how do I go about undoing the transaction block if;
a) the cancel button is selected or;
b) the window is closed (using x) and data entry has taken place.
I have a code block that walks the widget tree of the frame and checks the modified attribute of appropriate widgets. I have this firing on "CLOSE of THIS-PROCEDURE" and "CLOSE of THIS-PROCEDURE" firing from "CHOOSE of bu_cancel" which works fine but how do I then undo the transaction block MAIN-BLOCK if needed.
Thanks in advance.
Chris
I have a persistent procedure that adds or updates a record:
ON CLOSE OF THIS-PROCEDURE
DO:
... check any widgets have been modified
... if any have then ask the user if they want to cancel their changes
RUN disable_UI.
END.
MAIN-BLOCK: DO TRANSACTION ON ERROR UNDO, LEAVE
ON END-KEY UNDO, LEAVE:
.... create or find record EXCLUSIVE-LOCK.
.... various fields enabled for input
.... buttons bu_save and bu_cancel are also present
RUN enable_UI.
IF NOT THIS-PROCEDURE

WAIT-FOR CLOSE OF THIS-PROCEDURE OR CHOOSE OF bu_cancel.
END.
My questions is; how do I go about undoing the transaction block if;
a) the cancel button is selected or;
b) the window is closed (using x) and data entry has taken place.
I have a code block that walks the widget tree of the frame and checks the modified attribute of appropriate widgets. I have this firing on "CLOSE of THIS-PROCEDURE" and "CLOSE of THIS-PROCEDURE" firing from "CHOOSE of bu_cancel" which works fine but how do I then undo the transaction block MAIN-BLOCK if needed.
Thanks in advance.
Chris