************************************************** *-- Class: generictimer (c:\common\classes\handler.vcx) *-- ParentClass: tmrbase (c:\common\classes\msctrl.vcx) *-- BaseClass: timer *-- Time Stamp: 01/18/2000 03:30:04 PM *-- Pass the Do() method of this class an Object Name, Method Name, *-- and the interval to wait before executing the method. *-- If there is no code executing, this timer will cause the method to run. * DEFINE CLASS GenericTimer AS Timer Enabled = .F. Interval = 100 *-- Object Name whose method to call when the Timer Event occurs. ObjectName = "" *-- Character. Name of the Method to call when the TimeOut Event occurs. MethodName = "" Name = "GenericTimer" *-- This method starts the timer. Pass an object, *-- and the method to call. ie. Do(ThisApp, "Release()'). PROCEDURE Do LPARAMETER ObjectName, MethodName, Interval ASSERT VARTYPE(m.ObjectName) = "C" AND NOT EMPTY(m.ObjectName) ; MESSAGE "You must pass the Object Name which contains the " ; + "Method you wish to call." ASSERT VARTYPE(m.MethodName) = "C" AND NOT EMPTY(m.MethodName) ; MESSAGE "You must pass the Method you wish to run when the " ; + "Timeout occurs." IF VARTYPE(m.Interval) = "N" AND NOT EMPTY(m.Interval) This.Interval = m.Interval ENDIF This.Reset() This.ObjectName = m.ObjectName This.MethodName = m.MethodName This.Enabled = .T. RETURN ENDPROC *-- About this Class. PROCEDURE ReadMe #IF .F. Use this object to call methods where the call stack can get in the way of Release(), or similar situations. Pass the full Object name (with it's hierarchy). Pass the Method you wish to do. If desired, pass the number of multiseconds to wait before running that method. Default is .1 secords, or you can change the interval prior to issuing Do(). Example: oTimer = NEWOBJECT("GenericTimer", "Handler.VCX") oTimer.Interval = 1000 oTimer.Do("_SCREEN.x", "SetFocus()") or oTimer = NEWOBJECT("GenericTimer", "Handler.VCX") oTimer.Do("ThisApp", "Release()", 100) #ENDIF ENDPROC PROCEDURE Timer This.Enabled = .F. && Shut down the Timer if we're ready to run && the designated method. RETURN EVALUATE(This.ObjectName + "." + This.MethodName) ENDPROC ENDDEFINE>Hi...