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. php防止刷新(流量攻击)的一段代码

    <?php//查询禁止IP$ip =$_SERVER['REMOTE_ADDR'];$fileht=".htaccess2";if(!file_exists($fileht) ...

  2. Ubuntu12.04 安装Samba

    Ubuntu12.04 安装Samba Ubuntu12.04 安装Samba 本教程介绍了在Ubuntu12.04安装Samba文件服务器,以及如何配置它通过SMB协议共享文件,以及如何将用户添加. ...

  3. maven打包异常:软件包com.sun.org.apache.xml.internal.security.utils.Base64 不存在

    maven打包异常:软件包com.sun.org.apache.xml.internal.security.utils.Base64 不存在 将jre/lib/rt.jar添加到maven的compi ...

  4. java 编程时候的性能调优

    一.避免在循环条件中使用复杂表达式 在不做编译优化的情况下,在循环中,循环条件会被反复计算,如果不使用复杂表达式,而使循环条件值不变的话,程序将会运行的更快. 例子: import java.util ...

  5. rtc关机闹钟6 AlarmManagerService研究

    这个是 private void setLocked(int type, long when) { if (mNativeData != 0) {            // The kernel n ...

  6. java中几种常见字符集与乱码介绍

    1.  ASCII和Ansi编码 字符内码(charcter code)指的是用来代表字符的内码 .读者在输入和存储文档时都要使用内码,内码分为  单字节内码 -- Single-Byte chara ...

  7. Rank List

    Rank List Time Limit: 10000MS Memory Limit: 65536K Total Submissions: 9837 Accepted: 3303 Descriptio ...

  8. linux下使用tar命令(转)

    转至: http://www.cnblogs.com/li-hao/archive/2011/10/03/2198480.html 解压语法:tar [主选项+辅选项] 文件或者目录 使用该命令时,主 ...

  9. java实现按拼音排序名称

    private static String[] nameArray = {"张三","李四","王二","付火"}; @ ...

  10. MUI 版本更新

    MUI版本更新,一些js,css  就不写了. 一.app 端 1.APP html 代码 <li class="mui-table-view-cell"> <a ...