************************************************** *-- Class: cussqlthermo *-- ParentClass: custom *-- BaseClass: custom *---Created by: Mike Yearwood *-- Time Stamp: 10/18/05 09:07:11 PM * define class cussqlthermo as custom *-- Holds SET TALK setting at initialization. protected icOldSetTalk icOldSetTalk = "" *-- Holds SET NOTIFY setting at initialization. icOldSetNotify = "" *-- Holds the output window at initialization. protected icOldOutputWindow icOldOutputWindow = "" *-- Holds the name of the temporary output window. protected icNewOutputWindow icNewOutputWindow = "" *----Holds Escape settings protected cOnEscape cOnEscape= "" protected cSetEscape cSetEscape = "" name = "cussqlthermo" procedure destroy set talk off local ; lcNewOutputWindow, ; lcOldOutputWindow, ; lcOldSetNotify, ; lcOldSetTalk, lcOnEscape, lcSetEscape with this lcNewOutputWindow = .icNewOutputWindow lcOldOutputWindow = .icOldOutputWindow lcOldSetNotify = .icOldSetNotify lcOldSetTalk = .icOldSetTalk lcOnEscape = .cOnEscape lcSetEscape = .cSetEscape endwith if version(5)>=700 set notify &lcOldSetNotify endif set talk &lcOldOutputWindow release windows &lcNewOutputWindow set talk &lcOldSetTalk * Now restore our settings on escape &lcOnEscape if m.lcSetEscape = "OFF" set escape off else set escape on endif endproc procedure init *Class that activates SQL thermometer bar during init *and restores altered settings during destroy. with this .icOldSetTalk = set("TALK") set talk off .icOldOutputWindow = set("TALK",1) .icNewOutputWindow = "SQLThermo" + sys(2015) .cOnEscape = on('ESCAPE') .cSetEscape = set('ESCAPE') set escape on on escape plStop = YesNo("Are you sure you want to stop?") local m.lcNewOutputWindow lcNewOutputWindow = .icNewOutputWindow define window &lcNewOutputWindow. from -1000,-1000 to -500,-500 activate window &lcNewOutputWindow. in screen set talk window &lcNewOutputWindow if version(5)>=700 .icOldSetNotify = set("NOTIFY") set notify on endif endwith set talk on return .t. endproc enddefine * *-- EndDefine: cussqlthermo **************************************************You would need to instantiate your class before doing select statement. In form's error method you can do:
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? this.lRepeatRequery = .f. else * RETRY - doesn't work this.lRepeatRequery = .t. endif else dodefault(m.tnError, m.tcMethod, m.tnLine, m.tcSys16, m.toErrObj, m.tcMessage) endifSo, if the user pressed ESC and then answered No on the question, you would need to re-run your Select.