Creating Timer in Oracle D2k / Forms 6i and Displaying a Clock
原创
©著作权归作者所有:来自51CTO博客作者QUANWEIRU的原创作品,请联系作者获取转载授权,否则将追究法律责任
Creating Timer in Oracle D2k / Forms 6i and Displaying a Clock
This is about timer in D2k
An external clock can be constructed using timers. Timers correspond to internal clocks, which have a specific time period. When the specified duration expires, the timer can either perform an action once and stop or repeat the action regularly every time the timer expires. Timer duration is always in milliseconds. Timers are created using the CREATE_TIMER built in and require a WHEN-TIMER-EXPIRED trigger to be written at the form level. This trigger fires every time the timer expires.
Using REPEAT Timers
Let's create a display item, CURRENT_TIME, in the horizontal toolbar canvas CANVAS_TOOLBARcreated earlier. This item shows the time in HH24:MI:SS format and updates itself every second (the timer duration).
In the WHEN-NEW-FORM-INSTANCE trigger, create a timer named CLOCK_TIMER, which iterates after every one second and populates the CURRENT_TIME item with the system date in HH24:MI:SSformat. The code is as follows:
Create a WHEN-TIMER-EXPIRED trigger as follows:
Creating Timer in Oracle D2k / Forms 6i and Displaying a Clock
Reviewed by Rishion Mar 17 2013
Rating: 4