Saturday, 4 April 2020

PowerBuilder close query code to check unsaved changes on Datawindow

Write the below code in CloseQuery event in window level to find unsaved changes in Datawindow.

Integer li_count,li_ret

window aw_window
aw_window=this

FOR li_count = 1 TO UpperBound(control[])
IF TypeOf(aw_window.control[li_count])=Datawindow! Then 
Datawindow dw
dw=control[li_count]
IF dw.AcceptText() = 1 AND dw.ModifiedCount() > 0  THEN
li_ret=Messagebox('Alert','Changes Not Saved, Do you Want to Save it?',Question!,YesNo!,1)
If li_ret=1 Then Return 1
End if 
End if
NEXT



-Pushparaj

No comments: