//$- PLUSPAK GENERATED DOCUMENTATION // - YOU MUST NOT MODIFY THESE AUTO-GENERATED LINES // // cTimer.pkg // // Replaces DAC timer package which is too bloated. // // +------------------------------------------------------+ // | *** COPYRIGHT 1998, STARZEN. ALL RIGHT RESERVED *** | // | *** NO PART OF THIS CODE MAY BE TRANSMITTED *** | // | *** TO NON-LICENSE HOLDERS *** | // +------------------------------------------------------+ //$- PLUSPAK END GENERATED DOCUMENTATION //****************************************************************************| // CLASS cTimer | // | // Usage: | // Object oTimer is a cTimer | // Set piInterval to 2000 // Default 1000 | // | // Procedure OnTimer | // //TODO: Add your code here | // End_Procedure | // End_Object | // | // DESCRIPTION | // Objects of this class send periodic OnTimer events. The | // intervals between events is defined by the piInterval property. | // Windows will round the interval to the nearest 55 ms. | // | // Timer events get a low priority in Windows, and will not arrive | // if the program is busy. | // | //=PUBLIC INTERFACE===========================================================| // | //--PROPERTIES----------------------------------------------------------------| // piInterval The interval, in milliseconds (rounded to the | // nearest 55ms), between OnTimer events. | // IsRunning Is the Timer running? | // | //--EVENTS--------------------------------------------------------------------| // OnTimer This event will happen whenever the specified | // amount of time has passed and the timer is | // active. | //--METHODS-------------------------------------------------------------------| // DoStart Start the timer. Send after changing piInterval | // DoStop Stop the Timer | //============================================================================+ Use Windows //Use WinUser //Use WinKern #IFNDEF GET_SetTimer External_Function SetTimer "SetTimer" User32.DLL ; Integer hWnd ; Integer idTimer ; Integer idTimeout ; Pointer tmprc ; Returns Integer #ENDIF #IFNDEF GET_KillTimer External_Function KillTimer "KillTimer" User32.DLL ; Integer hWnd ; Integer idTimer ; Returns Integer #ENDIF Class cTimer is a DFControl // Procedure Construct_Object Forward Send Construct_Object Property String psClassName "cTimer" Property String psSuperClassName "DFControl" Set External_Class_Name "cTimer" to "static" Set External_Message WM_TIMER to Private_OnTimer Property Integer piInterval 1000 Property Integer IsRunning False Set Visible_State to FALSE End_Procedure // Procedure Private_OnTimer If (IsRunning(current_object)) Send OnTimer End_Procedure // Procedure OnTimer // this is the event sent End_Procedure // Procedure DoStart Handle hWnd Integer iInterval iId Get Window_Handle To hWnd Get piInterval To iInterval Move (SetTimer(hWnd, 1, iInterval, 0)) To iId Set IsRunning To True End_Procedure // Procedure DoStop Handle hWnd Integer iInterval iId Get Window_Handle To hWnd Get piInterval To iInterval Set IsRunning To False Move (KillTimer(hWnd, 1)) To iId End_Procedure // Procedure Page Integer iState Forward Send Page iState Send DoStart End_Procedure // Procedure Page_Delete Integer iState Send DoStop Forward Send Page_Delete iState End_Procedure // // Procedure OnDump String sProperty String sValue // If ghoProgram eq 0 Procedure_Return // framework not in use // Send OnDump To ghoProgram current_object sProperty sValue // End_Procedure // // Procedure DoDump // Send OnDump "piInterval" (piInterval(self)) // Send OnDump "IsRunning" (IsRunning(self)) // End_Procedure // End_Class // cTimer