Document ID:        22081.1
Subject:            Creating a Self Expiring Message on the status line
Author:             DRMILLS
Modified:           06 Mar 95 


   Creating a Self Expiring Message on the status line

Introduction
------------
This article outlines a simple method for providing Forms users with 
informational messages that will disappear of their own accord, after 
a set period of time.

Method
------
We simply use a procedure to issue the required message to the status line
with the NO_ACKNOWLEDGE parameter, and then start a timer for the required
reistance time of the message, say 2 or 3 seconds (2000 or 3000 milliseconds). 
When the timer expires we clean the message line off again.
If multiple messages are issued through the procedure, the timer is reset 
each time, rather than waiting for the required interval between each 
message. 
You could simply extend the technique to be the method for issuing all 
messages, with or without a time delay as required.

The sample code for this is as follows:

----------------------------------------------------------------------
Procedure TIMED_MSG ( msg in varchar2, interval in number) is              
 msg_timer timer;                                                          
begin                                                                       
 Message(msg, No_acknowledge); /* user does not need to accept */            
 msg_timer := find_timer('MSG_TIMER');                                       
 if not id_null(msg_timer) then /*the timer is currently in operation*/    
    -- then reset it                                              
    set_timer(msg_timer, interval, NO_REPEAT);
 else /* Create it */                                          
    msg_timer := create_timer('MSG_TIMER', interval, NO_REPEAT);
 end if;    
END;
-----------------------------------------------------------------------

The programmer would call it using, for example: 
 begin
  timed_msg('Processing your request, Please wait....',3000);
 end;

You could enhance this code to issue a BELL; if required and maybe to provide a 
Default expiry time.

Finally you need to add the following into your WHEN-TIMER-EXPIRED trigger, or 
create one if you do not have it.

-------------------------------------------------------------------------
declare
 expired_timer varchar2(30);
begin
 expired_timer := get_application_property(TIMER_NAME);
 if expired_timer = 'MSG_TIMER' then 
message(' ', NO_ACKNOWLEDGE); /* Clean the old message off */
 end if;
end;
-------------------------------------------------------------------------