I have written many posts previously on Timers in Oracle Forms like how to change images randomly with timers and how to display a clock using timer, 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 Timer.fmb
 
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;

Creating, Stopping, Re-Starting and Deleting a Timer in Oracle Forms的更多相关文章

  1. Creating Timer in Oracle D2k / Forms 6i and Displaying a Clock

    Creating Timer in Oracle D2k / Forms 6i and Displaying a Clock This is about timer in D2k An externa ...

  2. Create Timer Example To Show Image Presentation in Oracle Forms

    Suppose you want to change multiple images after a specified time in home screen of your oracle form ...

  3. Creating Custom Login Screen In Oracle Forms 10g

    Below is the example plsql unit to validate login credentials and after successful validation open a ...

  4. Creating Excel File in Oracle Forms

    Below is the example to create an excel file in Oracle Forms.Pass the Sql query string to the below ...

  5. How To Tune or Test PLSQL Code Performance in Oracle D2k Forms

    You can test or tune your program unit performance in Oracle forms with Ora_Prof package.Suppose you ...

  6. C#.NET 中的 Timer 计时器及 3 种使用方法

    定时器是系统常用的组件之一,程序员可以根据自己的需求定制一个定时器类型,也可以使用.net内建的定时器类型.在.net中一共为程序员提供了3种定时器: System.Windows.Forms.Tim ...

  7. 如何停止处于stopping状态的windows服务

    工作中有时需要启动和停止windows service,有时候会出现服务处于stopping或者starting的状态,但是,在services界面中,start service/stop servi ...

  8. 如何停止处于stopping状态的windows服务(使用taskkill)

    工作中有时需要启动和停止windows service,有时候会出现服务处于stopping或者starting的状态,但是,在services界面中,start service/stop servi ...

  9. boost timer

    Boost.Timer provides clocks to measure code performance. At first, it may seem like this library com ...

随机推荐

  1. zw版【转发·台湾nvp系列Delphi例程】HALCON HWindow Overlayer 1

    zw版[转发·台湾nvp系列Delphi例程]HALCON HWindow Overlayer 1 ------------------------------------HALCON HWindow ...

  2. $.trim()函数

    $.trim(str) 返回:string: 参数str :String类型,需要去除两端空白字符的字符串.如果参数str不是字符串类型,该函数将自动将其转为字符串(一般调用其toString()方法 ...

  3. 微软Sql server analysis service数据挖掘技术

    最新在一个项目中要求用到微软SSAS中的数据挖掘功能,虽然以前做项目的时候也经常用到SSAS中的多维数据集 (就是CUBE),但是始终没有对SSAS中的数据挖掘功能进行过了解.所以借着项目需求这股东风 ...

  4. IIS、Asp.net 编译时的临时文件路径(转载)

    IIS上部署的ASP.NET站点都会在一个.Net Framework的特定目录下生成临时编译文件增加ASP.NET站点的访问性能,有时候需要手动去删除这些临时编译文件,特别是发布新版本代码到IIS后 ...

  5. 集成Spring事物管理

    什么是事物 事物是访问数据库的一个操作序列,数据库应用系统通过事物集来完成对数据库的存取.事物的正确执行使得数据库从一种状态转换为另一种状态. 事物必须服从ISO/IEC所制定的ACID原则.ACID ...

  6. 学点儿c#语言wpf开发

    首发:个人博客,更新&纠错&回复 visual studio 2015,界面越来越漂亮了. 比起swift和python啥的,还是c#外观上更像java,windows的界面编程,wp ...

  7. 图解IoC 依赖注入

  8. Sed文本替换一例

    使用 Sed 完成文本替换操作任务是非常合适的. 现在, 假设我要将一个原有 Java 项目中的一些包及下面的类移到另一个项目中复用. Project javastudy: Packages: alg ...

  9. js里的匿名函数 数组排序

    // 匿名函数:其实就是函数的简写形式 var method =function(){ alert("123"); } method(); // 匿名函数可以用于事件的处理 fun ...

  10. hdwiki 在IIS 下的伪静态

    HDwiki有SEO设置的功能,此功能可以将HDwiki的页面进行URL静态化转换,从而使HDwiki内容更容易被搜索引擎挖掘,提高被收录的机率.注意事项        1.本功能对服务器环境有特殊要 ...