Document-ID:        41996.1
Subject:            SIMULATING WINDOWS HELP UTILITY IN ORACLE FORMS
Author:             Unknown
Last Modified:      29 Oct 96 


                Simulating Windows Help Utility in Oracle Forms
                ===============================================

This bulletin allows you to perform real-time lookups in Oracle Forms
4.5.  The interface resembles that of the Windows or Macintosh Help
systems, and you no longer need to press the Enter or Return key after
typing the lookup text.

Create a timer in the When-New-Form-Instance trigger, which fires as
you enter a form.  Use the following PL/SQL code:

DECLARE
   time_id  TIMER;
   half_sec NUMBER(3) := 500;  /* 500 milliseconds */
BEGIN
   timer_id := CREATE_TIMER('key_timer', half_sec, REPEAT);
   :global.txt := ''; /* populated with cumulative lookup text BEFORE
                         the most recent keystroke */
END;

Every half-second, the timer expires.  This causes the
When-Timer-Expired trigger to fire.

Create a When-Timer-Expired trigger that compares the lookup text plus
the most recent keystroke against the global variable, which lacks
that new keystroke.  When any difference exists between the two, this
invokes a Pre-Query trigger using the lookup text plus the SQL
wildcard character ('%').  Use the following PL/SQL code to perform
these tasks:

IF ((:look.entry <> :global.txt) OR
     :look.entry IS NULL AND :global.txt IS NOT NULL) OR
     :look.entry IS NOT NULL AND :global.txt IS NULL)) THEN
  :look.txt := :look.entry || '%';  /* 'entry' is the lookup field
                                        in the control block */
  :global.txt := :look.entry;
  GO_BLOCK('cal');  /* detail block */
  EXECUTE_QUERY;    /* invokes Pre-Query trigger */
  GO_BLOCK('look'); /* moves cursor back to control block */
END IF;