User Tools

Site Tools


ole_declare_a_window_ole_or_ocx_container_control_.htm
Navigation:  Language Reference > 8 - Controls > Control Declarations >====== OLE (declare a window OLE, COM or .OCX container control) ====== Previous pageReturn to chapter overviewNext page

NewC7.jpg

OLE ,AT( ) [,CURSOR( )] [,USE()] [,LAYOUT][,DISABLE] [,KEY()] [,MSG()] [,HLP()] [,SKIP] [,FULL] [,TIP()]
[,SCROLL] [,ALRT( )] [,HIDE] [,FONT( )] [,DROPID( )] [,COMPATIBILITY( )]
[, CREATE( ) ] [, CLIP ] [,property( value )]
OPEN( ) AUTOSIZE|
LINK( ) STRETCH|
DOCUMENT( ) ZOOM|
[ MENUBAR
multiple menu and/or item declarations
END ]
END

blk2blue.jpg

OLE Places an OLE (Object Linking and Embedding) or .OCX control on the WINDOW or TOOLBAR.
AT Specifies the initial size and location of the control (PROP:AT). If omitted, default values are selected by the control.
CURSOR Specifies a mouse cursor to display when the mouse is positioned over the control (PROP:CURSOR). If omitted, the WINDOW's CURSOR attribute is used, else the Windows default cursor is used.
USE A Field Equate Label or the label of a variable to receive the “value” of the control (PROP:USE).
LAYOUT Specifies the control's left-to-right or right-to-left display orientation (PROP:LAYOUT)
DISABLE Specifies the control appears dimmed when the WINDOW or APPLICATION is first opened (PROP:DISABLE).
KEY Specifies an integer constant or keycode equate that immediately gives focus to the control (PROP:KEY).
MSG Specifies a string constant containing the text to display in the status bar when the control has focus (PROP:MSG).
HLP Specifies a string constant containing the help system identifier for the control (PROP:HLP).
SKIP Specifies the control does not receive input focus and may only be accessed with the mouse or accelerator key (PROP:SKIP).
FULL Specifies the control expands to occupy the entire size of the WINDOW for any missing AT attribute width or height parameter (PROP:FULL).
TIP Specifies the text that displays as “balloon help” when the mouse cursor pauses over the control (PROP:ToolTip).
SCROLL Specifies the control scrolls with the window (PROP:SCROLL).
ALRT Specifies “hot” keys active for the control (PROP:ALRT).
HIDE Specifies the control does not appear when the WINDOW or APPLICATION is first opened (PROP:HIDE). UNHIDE must be used to display it.
FONT Specifies the display font for the control (PROP:FONT).
DROPID Specifies the control may serve as a drop target for drag-and-drop actions (PROP:DROPID).
COMPATIBILITY Specifies a compatibility mode for certain OLE or .OCX objects that require it (PROP:COMPATIBILITY).
CREATE Specifies the control creates a new OLE object or .OCX (PROP:CREATE).
OPEN Specifies the control opens an object from an OLE Compound Storage file (PROP:AT). When the object is opened, the saved version of the container properties are reloaded, so properties do not need to be re-specified.
LINK Specifies the OLE object is a link to an object from a file, for example an Excel spreadsheet (PROP:LINK).
DOCUMENT Specifies the OLE object is an object from a file, for example an Excel spreadsheet (PROP:DOCUMENT).
CLIP Specifies the OLE object only displays what fits into the size of the OLE container control's AT attribute (PROP:CLIP). If the object is larger than the OLE container control, only the top left corner displays.
AUTOSIZE Specifies the OLE object automatically resizes itself when the OLE container control's AT attribute parameters change at runtime using PROP:AT, (PROP:AUTOSIZE).
STRETCH Specifies the OLE object stretches to completely fill the size specified by the OLE container control's AT attribute (PROP:STRETCH).
ZOOM Specifies the OLE object stretches to fill the size specified by the OLE container control's AT attribute while maintaining the object's aspect ratio (PROP:ZOOM).
property A string constant containing the name of a custom property setting for the control.
value A string constant containing the property value number or EQUATE for the property.
MENUBAR Defines a menu structure for the control. This is  the same type of structure as a MENUBAR in an APPLICATION or WINDOW structure. The Menubar is shown upon activating the OLE control.The menubar is not merged into the application's menu.
menus and/or items MENU and/or ITEM declarations that define the menu selections.

The OLE control places an OLE, COM or .OCX control on the WINDOW or TOOLBAR (not valid in a REPORT) at the position and size specified by its AT attribute. The property attribute allows you to specify any additional property settings the COM or .OCX control may require. Valid properties and values for those properties would be defined in the custom control's documentation. You may have multiple property attributes on a single OLE control.

Registration Free COM

You can deploy your Clarion program that uses COM/OCX controls without having to install and “register” the control.  Registration-free COM activation requires you to have a .manifest file for your COM control.  This is usually supplied by the publisher of the control, but there are tools available that can generate the .manifest for the control.

Registration-free COM activation also requires you to have a linked in .manifest file for your Clarion .exe with a section that specifies the external dependency to the COM or OCX control. For example:

<;dependency>

<;dependentAssembly>

<;assemblyIdentity

version=“16.2.4.0”

processorArchitecture=“X86”

name=“Codejock.ChartPro”

type=“win32”

language=“*”

/>

<;/dependentAssembly>

<;/dependency>

The Templates can generate the .manifest file complete with the required dependency section. From the main App tree view just go to the Global Properties Tab and then press the Actions button.  When the dialog opens select the App Settings Tab and then press the Application Manifest button.

DependentManifest1

Clarion Events returned for the OLE control:

EVENT:Selected The control has received input focus.
EVENT:Accepted The user has completed using the control.
EVENT:PreAlertKey The user pressed an ALRT attribute hot key.
EVENT:AlertKey The user pressed an ALRT attribute hot key.
EVENT:Drop A successful drag-and-drop to the control.

Example:

 PROGRAM

 MAP

  INCLUDE('OCX.CLW')

 END

W   WINDOW('OCX Controls'),AT(,,200,200),RESIZE,STATUS(-1,-1),SYSTEM

    MENUBAR

     ITEM('E&amp;xit!'),USE(?Exit)

     ITEM('&amp;About!'),USE(?About)

     ITEM('&amp;Properties!'),USE(?Property)

    END

    OLE,AT(0,0,0,0),USE(?oc1),HIDE,CREATE('COMCTL.ImagelistCtrl.1')

    END

    OLE,AT(0,0,150,20),USE(?oc2),CREATE('TOOLBAR.ToolbarCtrl.1')

    END

   END

CODE

OPEN(W)

?oc1{'ListImages.Add(1,xyz,' &amp; ocxloadimage('IRCLOCK.BMP') &amp; ')'}

?oc1{'ListImages.Add(2,abc,' &amp; ocxloadimage('IRCLOCK2.BMP') &amp; ')'}

?oc2{'ImageList'} = ?oc1{PROP:Object}

LOOP X# = 1 TO 3

 ?oc2{'Buttons.Add(,,,,1)'};  ?oc2{'Buttons.Add(,,,,2)'}

END

ACCEPT

 CASE EVENT()

 OF EVENT:Accepted

  CASE FIELD()

  OF ?Exit

   BREAK

  OF ?About

   ?oc1{'AboutBox'}           !Display the OCX control's About Box

  OF ?Property

   ?oc1{PROP:DoVerb} = -7     !Display the OCX control's properties dialog

  END

 END

END

See Also:

Object Linking and Embedding

OLE (.OCX) Custom Controls

OCX Library Procedures

ole_declare_a_window_ole_or_ocx_container_control_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1