LPARAMETERS tnError, tcMethod, tnLine, tcSys16, toerrobj, tcMessage IF m.tnError = 1839 && SQL-Select was cancelled IF VARTYPE(m.plStop) = "L" AND m.plStop * Have we stopped already? ELSE * RETRY - doesn't work this.lRepeatRequery = .t. ENDIF ELSE DODEFAULT(tnError, tcMethod, tnLine, tcSys16, toErrobj, tcMessage) ENDIFIn its PopulateCursor method I put:
LOCAL lnRequeryResult lnRequeryResult = .REQUERY() && requeries the initially selected alias IF .lRepeatRequery = .t. and m.lnRequeryResult < 0 && the user tried to stop it .requery() ENDIFplStop is defined as private in the form's Search method (so it is visible to other objects) and on escape plStop = YesNo("Do you want to stop the process?")
>>SET ESCAPE ON >> SET NOTIFY ON >> ON ESCAPE plStop = YesNo("Are you sure you want to stop?") >> SET TALK WINDOW NOWINDOW >> SET TALK ON >> .nRecords = EVALUATE('thisform.obizObj.PopulateCursor('+ ; >> .cParams +')')>>
>>LPARAMETERS nError, cMethod, nLine, tcSys16, toErrObj >>IF m.nError = 1839 && Requery cancelled >> >> IF VARTYPE(m.plStop) = "L" AND m.plStop >> * Have we stopped already? >> ELSE >> RETRY >> ENDIF >>ELSE >> DODEFAULT(nError, cMethod, nLine, tcSys16, toErrObj) >>ENDIF>>
>on escape do abc > > >func abc() > Escaped = TRUE > retry && I added this one since I got the error during the requery >endfunc > > >and in a loop I checked Escaped once a second >