博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Creating, Stopping, Re-Starting and Deleting a Timer in Oracle Forms
阅读量:4842 次
发布时间:2019-06-11

本文共 2698 字,大约阅读时间需要 8 分钟。

I have written many posts previously on Timers in Oracle Forms like 
and 
, but in this post I am simply describing to how to create a timer, stop a timer, re-start a timer and deleting a timer.
 
The following is the screen shot for this example showing a progress bar based on a display item:
 
 
You can also download this form from the following link
 
Create a display item with the following properties:
 
Name: Prgbar
Width: 5
Bevel: Plain
Background Color: blue
 
Write the following code for the "Create Timer" button:
When-Button-Pressed trigger
Declare
v_timer timer;
Begin
-- find timer first if already exists.
v_timer := find_timer('PrgBarTmr');
if id_null(v_timer) then
-- Creating timer for one second... one second = 1000 millisecond
v_timer := Create_Timer('PrgBarTmr', 1000, Repeat);
else
message('already exists.');
end if;
-- will handle this timer in form level when-timer-expired trigger
End;

Write the following code for the "Stop Timer" buton:
When-Button-Pressed trigger
Declare
v_timer timer;
Begin
-- find the timer first
v_timer := find_timer('PrgBarTmr');
if not id_null(v_timer) then
-- this will stop the timer after one millisecond
Set_Timer(v_timer, 1, No_Repeat);
end if;
-- will handle this timer in form level when-timer-expired trigger
End;

Write the following code for the "Re-Start Timer" buton:
When-Button-Pressed trigger
Declare
v_timer timer;
Begin
-- find the timer first
v_timer := find_timer('prgbartmr');
if not id_null(v_timer) then
-- this will re-start the timer after one second
Set_Timer(v_timer, 1000, Repeat);
else
v_timer := create_timer('prgbartmr',1000, Repeat);
end if;
-- will handle this timer in form level when-timer-expired trigger
End;

Write the following code for the "Delete Timer" buton:
When-Button-Pressed trigger
Declare
v_timer timer;
Begin
-- find the timer first
v_timer := find_timer('PrgBarTmr');
if not id_null(v_timer) then
-- this will delete the timer
Delete_Timer(v_timer);
end if;
End;

Then finally write the code for When-Timer-Expired trigger at form level to handle the timer and to do specific task:

When-Timer-Expired trigger
Declare
v_timer_name varchar2(30);
v_width number;
Begin
-- get the timer name first.. to know which timer has expired.. if multiple timer are running
  v_timer_name := get_application_property(timer_name);
  -- check if the same timer with capital letters
  if v_timer_name = 'PRGBARTMR' then
    v_width := get_item_property('blKtmr.prgbar', width);
    if v_width < 100 then
       v_width := v_width + 5;
    else
       v_width := 0;
    end if;
    set_item_property('blktmr.prgbar', width, v_width);
end if;
-- will handle this timer in form level when-timer-expired trigger
End;

转载于:https://www.cnblogs.com/quanweiru/p/6220070.html

你可能感兴趣的文章
蓝牙 简书
查看>>
SQL Server系统表sysobjects介绍与使用
查看>>
【转】C/C++除法实现方式及负数取模详解
查看>>
传输层协议
查看>>
Struts2 拦截器处理普通Http请求和Ajax请求时拦截配置
查看>>
例题---
查看>>
平安度过2012,新的一年新的希望
查看>>
MySQL prompt命令
查看>>
hbase读取文件
查看>>
2周《机电传动控制》学习笔记
查看>>
DS博客作业06--图
查看>>
安装--->Tomcat监控工具Probe
查看>>
Java网络编程(URL&URLConnection)
查看>>
Java NIO学习笔记---I/O与NIO概述
查看>>
java接口中的成员方法和成员变量
查看>>
java中构造函数的特点
查看>>
Qt5:窗口背景色的设置
查看>>
NFC初步接触
查看>>
Puppet常识梳理
查看>>
iframe内联网页的应用
查看>>