Module Dftimer.pkg

************************************************************************ --- DFTimer Timer package for DataFlex programs Copyright (c) 1983-2002 Data Access Corporation, Miami Florida, All rights reserved. DataFlex is a registered trademark of Data Access Corporation. ************************************************************************ Description: This package contains all components needed to implement timers in a DataFlex 4 program. Author: Eddy Kleinjan, Data Access Nederland ************************************************************************ 03/03/2001 EK Fixed Timer_Active_State to check for valid windows handle before trying to set or kill a timer. Fixed Kill_All_Timers to check for valid windows handle before trying to kill a timer. The windows handle might not exist anymore when the program is being exited using Exit_Application. 12/13/2001 JJT fixed Timer_Active_State to check for -1 (not 0). Fixed a a bug where set Timeout started inactive timers. Added code to force timer object to desktop ************************************************************************ CLASS DFTimer Usage: Object MyTimer is a DFTimer Set Timeout to 2000 // Default 1000 Set Auto_Start_State to TRUE|FALSE // Default TRUE Set Auto_Stop_State to TRUE|FALSE // Default TRUE Set Timer_Message to MyMessage // Default 0 Set Timer_Object to (MyObject(self)) // Default 0 Set Timer_Active_State to TRUE|FALSE // Default FALSE // Augment when no Timer_Message Procedure OnTimer Send Info_Box "HEY, WAKE UP!" End_Procedure End_Object DESCRIPTION Objects of this class can be used to trigger an event after a certain amount of time has passed. You can specify this time by setting the Timeout property of the object. This timeout is in miliseconds. Whenever a timer event happens, it will notify the object by sending an OnTimer event. You can trap this event to do whatever you want the timer to do. By default this OnTimer event will send the Timer_Message to Timer_Object, when these have been specified. By default, you have to activate a timer by setting its Timer_Active_State to TRUE. When the timer has been placed inside a user-interface object, it can also be activated automatically when this user-interface object is being activated. This only happes when it Auto_Start_State is TRUE, which is the default setting. In such a case, the timer will also automatically being stopped when the user-interface object is taken of the screen. This depends on the Auto_Stop_Timer state to happen. When you need to set a new timeout value, you can do so even when the timer is active. It will adjust the timeout immediately. Note that timer events depend on Windows for the delivery of the event. Since timer events get a low priority in Windows, it might put your program on hold when other programs are very busy. In such a case, you will only receive one timer event after the process stopped. There is no way, other than calculating it yourself, to determine how many time has passed or how many timer event should have happened since the last timer event or timer activation. PUBLIC INTERFACE PROPERTIES Auto_Start_State When TRUE (default) the timer will be activated automatically when the object will be (virtually) paged on the screen. Example: When a timer object has been placed inside a view, then the timer will be activated when the view is activated. Auto_Stop_State When TRUE (default) the timer will be deactivated automatically when the object will be (virtually) taken off the screen. Timeout The timeout value for the timer to fire. The timeout value must be set in miliseconds. This property may be set even when the timer is active. The new timeout value will be applied immediately. NOTE: The timeout set here is never precise. It depends on Windows to deliver the message to our application. Default 1000. Timer_Active_State Set to TRUE to activate the timer, to FALSE to deactivate the timer. Timer_Message This property can be set to a messageID which has to be sent whenever a timer event occurs. Default this message will be send to the object itself unless a Timer_Object as been specified. Timer_Object This property can be set to an objectID which has to receive the Timer_Message whenever a timer event occurs. This value has no meaning when no Timer_Message has been set. METHODS OnTimer This event will happen whenever the specified amount of time has passed and the timer is active. By default it sends the message in the Timer_Message property to the object in the Timer_Object when these have been specified. When you don't need this, you can just override the OnTimer event. PUBLIC INTERFACE Page_Object Has been augmented to auto_start the timer when it becomes active as part or a user-interface object. Page_Delete Has been augmented to auto_stop the timer when it is deactivated as part or a user-interface object. Destroy_Object Has been augmented to deactivate the timer.

References (2):

ModuleLine
oCommandBarSystem_Standard.pkg2
OrderPrecompile.pkg3

Field References (0):

ModuleContaining SymbolLine