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 InpaintingCt1

    zw版[转发·台湾nvp系列Delphi例程]HALCON InpaintingCt1 unit Unit1;interfaceuses Windows, Messages, SysUtils, Va ...

  2. [sinatra] Sinatra再入门

    原文URL:http://www.rubycc.com/bbs/topic_detail/86 1.基础代码app.rb require 'rubygems' require 'sinatra/bas ...

  3. HorizontalScrollView水平滑动

    xml布局 <HorizontalScrollView            android:id="@+id/hsv"            android:layout_ ...

  4. Backup: Array in Perl6

    Array in Perl6 继承List,而List又继承Iterable,Positional,Cool ARRAY.pop ARRAY.shift ARRAY.push: VALUES ARRA ...

  5. Linux中文显示乱码解决

    输入 echo $LANG可以查看当前使用的系统语言 查看是否有中文语言包可以在终端输入 locale命令,如有zh cn 表示已经安装了中文语言 没有则 yum groupinstall chine ...

  6. 非常好!!!【从头开始写操作系统系列】实现一个-GDT(1)【转】

    转自:http://blog.csdn.net/luoyhang003/article/details/47338019 权声明:本文为博主原创文章,未经博主允许不得转载.(文章来源:http://b ...

  7. Valid Anagram

    class Solution { public: bool isAnagram(string s, string t) { if(t=="") return s=="&q ...

  8. WEB前端常用网站收集

    WEB前端常用网站收集整理 w3school.w3schools 前端里.脚本之家.素材家园 17素材.frontopen NEC更好的CSS方案.一些常用的JS实例 Bootstrap  官网  h ...

  9. centos6.5-64bit安装htop

    首先启用 EPEL Repository: yum -y install epel-release 启用 EPEL Repository 後, 可以用 yum 直接安裝 Htop: yum -y in ...

  10. 20145227 《Java程序设计》第9周学习总结

    20145227 <Java程序设计>第9周学习总结 教材学习内容总结 1.JDBC简介 JDBC全名Java DataBase Connectivity,是java联机数据库的标准规范. ...