Home SQL PHP HTML Perl PowerBuilder C/C++ General Solutions Contacts

PowerBuilder

Index

Tips

Datawindow Timer
Executable Name
Include Objects
Is Executable?
Object Exists?

Objects

Downloads

Datawindow timer event

Purpose

It's quite possible to add a timer to a datawindow, it's just not very well documented! This page tells you how to do it.

How to do it

Starting

Create a new Datawindow control, declare a new event within this object and call it whatever you like (I personally use ue_timer). Map this event to the pbm_timer event id. You've just created a timer event for your datawindow control.

Setting the timer interval

To make use of the timer event, the attached Datawindow object must have the Timer Interval property set. In Powerbuilder v7, this is set in the General tab of the Properties pane, the interval is set in milliseconds.

If you wish to set the value programatically, the property is "DataWindow.Timer_Interval" when using the Modify syntax, or "dw_control.Object.DataWindow.Timer_Interval" using the dot notation.

Using the event

Enter code into your event, it should now run at the specified interval. Please also see the notes below.

Notes

  • The timer value is set in milliseconds, unlike the Timer() function for standard Timer events.
  • You need to include at least one field with an expression calling Now() or Today(), in the datawindow object attached to the datawindow control, to make the timer work.

Suggestions

This is useful stuff for a framework, it may be useful to define the event in your base datawindow class. It would also be advisable to create a function to set the timer_interval, so you have a standard interface. If you're being particularly adventurous you could also use create, within a datawindow modify, to add a field with an expression mapping to the Now() function, thereby eliminating the need to remember to add this field.

Details

Author:     Wayne Jones
Created:    12 December 2002
Works with: Should work with any version
This is Code, all contents copyright - © Wayne Jones 2004.