SET TIMER

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 6.5


SET TIMER (tickCount)

ParameterTypeDescription
tickCountLongintTickcount

Description

The SET TIMER command allows you to activate the On Timer form event and to set, for the current process, the number of ticks elapsed between each On Timer form event.

Note: For more information about this new form event, please refer to the description of the command Form event.

If this command is called in a context in which it is not displaying a form, it will have no effect.

4D's Web server can take advantage of this command as well as the On Timer form event to resend 4D forms. This feature allows you to obtain HTML pages updated in "real time" while saving bandwidth. Actually, updating a form in this case is not automatic; you must call the REDRAW command. You can then optimize the system by calling REDRAW only when the data has been modified.

Only browsers that interpret JavaScript allow you to automatically redraw pages. The laps defined by SET TIMER will be used by the browser and by the timeout of the Web process. The laps must be a few seconds (5 being a practical value). For more information, please refer to the second example shown below.

To procedurally disable the triggering of the On Timer form event, call SET TIMER again and pass 0 in tickCount.

Examples

1. Let's imagine that you want, when a form is displayed on screen, the computer to beep every three seconds. To do so, write the following form method:

   If (Form event=On Load)
      SET TIMER(60*3)
   End if 

   If (Form event=On Timer)
      BEEP
   End if

2. Let us imagine that you want your Web server to update a 4D form displayed on the Web browser every five seconds. To do so, write the following form method:

   If (Form event=On Load)
      SET TIMER(60*5)
   End if 

   If (Form event=On Timer)
      ...   `You can place a test here to see if the data is being modified and to 
         `execute the following line only if this is true. 
      REDRAW ([MyTable])
   End if

See Also

Form event, REDRAW.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next