Creating, Stopping, Re-Starting and Deleting a Timer in Oracle Forms

时间:2022-09-04 22:59:08
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:
 
Creating, Stopping, Re-Starting and Deleting a Timer in Oracle Forms
 
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 &sol; 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&num;&period;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. SortedMap接口

    SortedMap接口是排序接口,只要是实现了此接口的子类,都属于排序的子类,TreeMap也是此接口的一个子类. import java.util.Map; import java.util.Sor ...

  2. VC&plus;&plus;编译GSL

    目录 第1章 VC++    1 1.1 修改行结束符    1 1.2 修改#include "*.c" 为 #include "*.inl"    2 1. ...

  3. MVVM Light须要注意的10个问题

    MVVM Light须要注意的10个问题 从使用XAML技术基础開始(实际上并非非常久曾经).我便关注MVVM(Model – View – ViewModel)模式.偶然接触到MVVM Light不 ...

  4. 二、js的控制语句

    二.流程控制语句 ECMA-262规定了一组流程控制语句.语句定义了ECMAScript中的主要语法,语句通常由一个或者多个关键字来完成给定的任务.诸如:判断.循环.退出等.   语句的定义   在E ...

  5. 财务模块多组织&comma;GL&comma; SLA&comma; SOB&comma; COA&comma; BSV&comma; CCID&comma; LE 概念的简单介绍

     GL=  General Ledger 指的是Oracle 的总帐系统. application_id = 101. 在uk似乎居然还有不同的解释(In the UK, it was refer ...

  6. WIFI探针 搞定

  7. 【Java基础】5、java中的匿名内部类

    匿名内部类也就是没有名字的内部类 正因为没有名字,所以匿名内部类只能使用一次,它通常用来简化代码编写 但使用匿名内部类还有个前提条件:必须继承一个父类或实现一个接口 实例1:使用匿名内部类来实现抽象方 ...

  8. 正则表达式详解&lt&semi;一&gt&semi;

    正则表达式是一种处理字符串的微型语言:有以下的基本术语: l  模式(pattern):正则表达式实际上是通过字符串表达的一个模式 l  匹配(match): 判断正则表达式和给出的序列[first ...

  9. Spring定时&lpar;任务&rpar;刷新-quartz

    Quartz是一个完全由java编写的开源作业调度框架.他可以与J2EE.J2SE集成,用与处理定时任务.定时刷新的需求.此处使用为与Spring项目集成. 在SpringMVC项目中使用quartz ...

  10. jquery对象和javascript对象即DOM对象相互转换

    jquery对象和javascript对象即DOM对象相互转换 1. DOM 对象转成 jQuery 对象对于已经是一个 DOM 对象,只需要用 $() 把DOM对象包装起来,就可以获得一个 jQue ...