Link to home
Start Free TrialLog in
Avatar of baskomurcu
baskomurcu

asked on

Oracle OLE Controls Documentation?

Does anybody know where to find detailed information for using Oracle OLE controls (for example Oracle Treeview ControlV1.0)?

Or has anybody used any OLE2 controls in Forms 4.5 and could share his/her experience in this field. Especially in calling methods of the objects and setting propperties.
Thanks in advance.

Ali Baskomurcu
Avatar of baskomurcu
baskomurcu

ASKER

Edited text of question
Adjusted points to 150
ASKER CERTIFIED SOLUTION
Avatar of poncejua
poncejua

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I searched the site already but couldn't find any useful information. I will make the question more precise:

I'm using Forms (32bit) 4.5.8.1.2 on a Windows NT 4.0 Workstation. I first create an OLE container on a blank canvas. Then I use the 'Insert Object' menu option and select 'Create Control'. I insert the 'TreeView Control' (this control works properly with Microsoft Visual FoxPro 5.0 on the same computer). Then I create a Pushbutton on the same canvas executing the following code:
---------------------------
declare
ole_obj      ole2.obj_type;

begin

 ole_obj := forms_ole.get_interface_pointer('block1.job_tree');
 ole2.set_property(ole_obj,'WIDTH','200');

end;
---------------------------

This command should simply adjust the OLE Controls width to 200. I get the following error message when I execute the form and click the button:
FRM-41344 OLE Object not defined for JOB_TREE in the current record.

Got any comment? Thanks for your help in advance.

Ali Baskomurcu.
Hi,

I found some documents. I hope you find them useful.

===================================================

Summary:
FRM-41344 USING FORMS_OLE.GET_INTERFACE_POINTER

+=+

Problem Description:
====================
 
You are receiving the following error using Oracle Forms:
 
   FRM-41344:  OLE object not defined for <item name> in current record.
 
 
Problem Explanation:
====================
 
This error occurs when you are issuing the FORMS_OLE.GET_INTERFACE_POINTER
built-in to get the handle to an OCX object.  
 
You may be receiving this error while implementing the following
Developer/2000 White Paper:
 
    "An Introduction to the Integration of OCX Controls into
    Developer/2000 Forms 4.5"
 
 
[ Search words: formsole get interface, pointer, container  
                WHEN-NEW-FORM-INSTANCE ]  


+==+

Diagnostics and References:

 * {6508.6,Y,100}     OLE CONTROLS (OCX)
 * {8114.6,Y,100}     USES WHEN-NEW-FORM-INSTANCE TRIGGER
 * {11049.6,Y,100}     FRM-41344
 * {11050.6,Y,100}     TRIES TO RETURN HANDLE OF OCX OBJECT


2. Soln# 2068513.6  DISPLAY OCX'S CANVAS OR ISSUE SYNCHRONIZE BEFORE FORMS_

Solution ID         : 2068513.6
For Problem         : 1020265.6
Affected Platforms  : Generic: not platform specific
Affected Products   : SQL*Forms
Affected Components : SF40 V04.05.XX
Affected Oracle Vsn : Generic

Summary:
DISPLAY OCX'S CANVAS OR ISSUE SYNCHRONIZE BEFORE FORMS_OLE.GET_INTERFACE_POINTER

+=+

Solution Description:
=====================
 
To correct FRM-41344, do one of the following BEFORE calling
FORMS_OLE.GET_INTERFACE_POINTER:
 
 
1.  Issue the SYNCHRONIZE built-in
 
or
 
2.  Display the canvas or window that contains the OCX object.  To display  
    the correct canvas that contains the OLE object, do one of the following:  
 
    o  Issue the SHOW_VIEW built-in
 
    OR
 
    o  Issue the GO_BLOCK or GO_ITEM built-in to navigate to a block or item
       on the canvas then issue the SYNCHRONIZE built-in.
 
 
Solution Explanation:
=====================
 
An OCX control is not instantiated until it is drawn. To ensure that the
OCX is drawn, call the SYNCHRONIZE built-in or display the canvas containing
the OLE object before using FORMS_OLE.GET_INTERFACE_POINTER.
 
 
Additional Information:
=======================
 
Oracle Documentation:
---------------------
Oracle Forms Reference Manual Volume 1
Chapter 3, Built-in Subprograms
  FORMS_OLE.GET_INTERFACE_POINTER
  GO_BLOCK
  GO_ITEM
  SYNCHRONIZE
  SHOW_VIEW
 
Oracle White Papers:
--------------------
An Introduction to the Integration of OCX Controls into Developer/2000  
   Forms 4.5
 
Integration of OCX Controls in Forms 4.5  
 
Related Bugs:
-------------
Bug 373526 ( Closed - NOT a bug )
FRM-41344 ERROR WHEN ATTEMPTING TO SET OCX VALUES IN WHEN-NEW-FORM-INSTANCE
 
==================================================

Using OCX Tab Controls With Forms 4.5
            =====================================

Introduction
------------

This bulletin gives step-by-step instructions for building a form with
an OCX Tab control.  This example uses the TAB OCX from VideoSoft.  If
you are using an OCX from another vendor, the techniques given in this
bulletin work provided that you adapt the appropriate property names
and settings for your OCX.  Make sure you have the documentation for
your OCX control, so you can learn what properties you need to set or
detect.

Regardless of which OCX control that you use, you must have a proper
license to use the OCX.  Check with your vendor for licensing requirements.

OCX controls provide additional functionality for Oracle Forms as
embedded OLE objects.  There are three common areas of interest with
an OCX control.  The OCX Properties control things like color and
size.  The OCX Methods are functions of the control.  Third are OCX
Events.  An example of an Event is changing the current Tab focus in
response to pressing a Tab on the control.

Release 1.3 of Oracle Forms has restrictions on the use of OCX
controls.  Primarily, Forms cannot detect an OCX event directly.
However, as Events generally change properties of the OCX, you can
"check" the setting of a property and perform an action based on the
current setting.  Additionally, you cannot set every property of the
OCX at design time; some must be set at runtime.  An anticipated
enhancement of Developer/2000 Release 2.0 is that Forms will be
"informed" of OCX events that have occurred.


Registration
------------
If you install your OCX control via an installation program, the
installation program registers the control in the system registry.  If
you are not using an installation program, copy the OCX license file
and any required DLLs under the /windows/system, /windows95/system, or
/winnt/system directory.  You can place the OCX file in any directory.
Make sure that you register the OCX by running regsvr32.exe.  Failure
to properly register the OCX can cause the OCX control to not appear
in the form or behave unexpectedly.


Example: Form Design and Layout
-------------------------------
This example builds a master-detail form based on the dept and emp tables.

1.  Create a form.
2.  Create a canvas.
3.  Invoke the Layout Editor for the canvas.
4.  Add an OLE item using the OLE item tool.
5.  Set the following properties of the OLE item:

       OLE In-Place Activation           True
       OLE Activation Style           Manual
       OLE Resize Style            Scale
       OLE Tenant Types            Embedded
       Show OLE Popup Menu           False

6.  Right-mouse-click on the OLE item.
7.  Select the Insert Object option.
    The Insert Object dialog box appears on your screen.
8.  Click on the "Create New" button.
    A listing of registered OLE controls appears.
9.  Select the VideoSoft Index Tab Control.
    A rectangle then appears where the OLE item is on the canvas.
    If this does not happen, make sure you have properly registered the OCX
    and are not missing a DLL required by the OCX control.
10. Create two stacked canvases called department and employee.
11. Size the canvases to fit inside the OLE item.
12. Set the canvas-view's x and y coordinates
    so the stacked canvas appears inside the OLE item.
    The position and size of these canvases are important;
    make sure the stack canvases have the correct settings.
13. Create a block based on the dept table, and assign it to the
    department canvas.
14. Create a block based on the emp table.
    a.      Select the empno, ename, sal and deptno columns.
    b.      Create a relation identifying the dept as the master block.
    c.      Assign the block to the employee canvas.

At this point, your form consists of a main canvas with an OLE item, a
stacked canvas called department with a block based on the dept table,
and a stacked canvas called employee based on the emp table.  Both of
the stacked canvases fit and are located in the OLE item when called.


Example: Coding
---------------
As previously stated, the current release of Forms does not include
"awareness" of OCX events.  To overcome this, you create a timer and a
When-Timer-Expired trigger to check the value of the CurrTab property
of the OCX and perform a specific action based on that value.

Create the following trigger code to make the form respond to the tab changing:

Create a When-New-Form-Instance trigger:
DECLARE
   timer_id             TIMER;
   Tab_Control_Handle  OLE2.OBJ_TYPE;
/* Note you can replace the data type OLE2.OBJ_TYPE with PLS_INTEGER. */

BEGIN
   timer_id := FIND_TIMER('TAB_STATUS');
/* Synchronize the form. */
   SYNCHRONIZE;

/* Get a handle to the OCX control. */
   Tab_Control_Handle := FORMS_OLE.GET_INTERFACE_POINTER('Tabs.Tab_OCX');

/* Label the tabs.  Note that each label is separated by the | symbol.
** The number of labels determine the number of tabs. */
   OLE2.SET_PROPERTY(Tab_Control_Handle, 'Caption', 'Department|Employees');

/* Set the Tab Style.
** Experiment with this setting to get the desired effect. */
   OLE2.SET_PROPERTY(Tab_Control_Handle, 'Style', '3');

/* Set any other properties that you wish to set in this trigger.
** Release the OLE item handle. */
   OLE2.RELEASE_OBJ(Tab_Control);

/* Start the timer. */
   IF ID_NULL(timer_id) THEN -- not already running
      timer_id := CREATE_TIMER('TAB_STATUS', 400, REPEAT);
   END IF;

/* Go to the DEPT block, and execute a query. */
   GO_BLOCK('DEPT');
   SYNCHRONIZE;
   EXECUTE_QUERY;
END;


Create a When-Timer-Expired trigger:
DECLARE
   Tab_Control_Handle  OLE2.OBJ_TYPE;
   current_tab             VARCHAR2(1);

BEGIN
/* Get a handle to the OLE item. */
   Tab_Control_Handle := FORMS_OLE.GET_INTERFACE_POINTER('Tabs.Tab_OCX');

/* Get the value of the CurrTab property for the OCX. */
   current_tab := OLE2.GET_NUM_PROPERTY(Tab_Control_Handle, 'CurrTab');

/* Release the handle to the OLE item. */
   OLE2.RELEASE_OBJ(Tab_Control_Handle);
   DEFAULT_VALUE('0', 'global.old_tab');
   IF :global.old_tab != current_tab THEN
      IF current_tab = '0' THEN
      -- If the CurrTab index is at 0, go to the DEPT block.
       GO_ITEM('DEPT.DEPTNO');
      ELSE
      -- If you are using more than two tabs, put ELSIF statements as needed.
       GO_ITEM('EMP.EMPNO');
      END IF;
      :global.old_tab := current_tab;
   END IF;
END;


Common Errors
-------------
Problem 1:
FRM-41344:  OLE Object not defined for <item name> in the current record.
ORA-305500: Unhandled Exception.

Solution 1:
Both the these errors are rather generic and occur after a call to the
FORMS_OLE.GET_INTERFACE_POINTER.  Ensure that you have properly
registered the OCX and installed all of the required DLLs.

If these errors occur after you try setting or getting a property of
the OCX, make sure that the property you are trying to call has the
correct syntax and datatypes.  Properties are case-sensitive.


Problem 2:
The canvas associated with a Tab takes too long to display.

Solution 2:
Remember that all of the processing for displaying the appropriate
canvas occurs in a When-Timer-Expired trigger.      If other triggers are
executing when your timer expires, those triggers are not interrupted.


Conclusion
----------
The techniques given above are all you need to integrate the VideoSoft
Tab OCX with Oracle Forms.  The key to success with OCX controls is
understanding the properties of the OCX and their proper syntax.

===================================================

Problem Description:
====================
 
You are using Version 5 of the VideoSoft OCX tab control in a 32-bit
Oracle Forms application.
 
Case 1: OLE Tenant Types = Embedded
-----------------------------------
When you set the OLE Tenant Types property to Embedded,
the tabs do not appear and the following error appears in the console
message line:
 
user defined exception
 
 
Case 2: OLE Tenant Types = Any
------------------------------
When you set the OLE Tenant Types property to Any, no error occurs,
but when you close and reopen the form, the OCX tab control shrinks
in size.
 


+==+

Diagnostics and References:

 * {6508.6,Y,100}     OLE CONTROLS (OCX)
 * {11124.6,Y,100}     USES VIDEOSOFT INDEX TAB CONTROL (AN OCX)
 * {11125.6,Y,100}     SETS OLE TENANT TYPES PROPERTY TO EMBEDDED
 * {11126.6,Y,100}     USER DEFINED EXCEPTION
 * {11127.6,Y,100}     OCX TAB CONTROL RESIZES


2. Soln# 2081122.6  BUG 504630 FIXED IN FORMS 5.0.4.16.0 -- WORKAROUND AVAI

Solution ID         : 2081122.6
For Problem         : 1033901.6
Affected Platforms  : Microsoft Windows
                      MS Windows 95
                      Intel Windows NT
Affected Products   : SQL*Forms
Affected Components : SF40 V04.05.XX
Affected Oracle Vsn : Generic

Summary:
BUG 504630 FIXED IN FORMS 5.0.4.16.0 -- WORKAROUND AVAILABLE

+=+

Solution Description:
=====================
 
This is bug 504630, which is fixed in Oracle Forms 5.0.4.16.0.
 
Workaround
----------
1.  On the OLE Control Properties Sheet, set the following properties:
 
    Navigation
    ----------
    Enabled                     True
    Navigable                   True
    Mouse Navigate              True
 
    Functional
    ----------
    OLE In-Place Activation     True
    OLE Activation Style        Manual
    OLE Resize Style            Scale
    OLE Tenant Types            Any  
    Show OLE Popup Menu         True
    Show OLE Tenant Type        True
    OLE Class                   VSOCX.VsindextabCtrl.1
    OLE Do In Out               True
    OLE Tenant Aspect           Content
 
2.  Before you attempt to create the tabs, you must do the following:
    a.  Navigate to the block which has the OLE container.
        This block must be active.
    b.  Issue the SYNCHRONIZE built-in.
 
    For more information, refer to GSX Entry 1020265.6.
 
    Hence, to build the tabs, create code similar to the following:
 
    DECLARE
       --
       --  Enter declarations.
       --
       hOCXHandle   OLE2.OBJ_TYPE;
    BEGIN
       GO_BLOCK('TAB_BLOCK') -- block where OLE container resides
       SYNCHRONIZE;
       hOCXHandle := FORMS_OLE.GET_INTERFACE_POINTER('tab.ole_container');
       --
       --  Insert code that creates the tabs.  
       --
    END;
 
 
Additional Information:
=======================
 
Related Bugs:
-------------
504630
OLE:VIDEOSOFT INDEX TAB CNTRL VER 5.0 DOES NOT SHOW IN OLE CONTAINER
(TRIAGE0697)
 
===================================================

If you need any additional info please let me know.

Regards,

Juan Manuel Ponce Martinez