Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. {{tag>category:"presentation server" }} ====== OLE Control Integration ====== === Published 20 NOV 2013 at 07:00:53AM === == Updated on 18 NOV 2013 at 07:00:53AM == One of the goals for version 10 is better OLE control (OCX) integration and support. A major part of that objective is the ability to //register// OLE controls with the IDE and //bind// them to the database in a similar fashion to the standard controls such as Edit Lines, Edit Tables and so on. In this post we'll be taking a brief look at how this new functionality is being implemented. ==== Registering OLE Controls ==== OpenInsight 10 supports a new repository type called "OLECONTROL". This represents an OLE control "registration record" (stored in the new SYSREPOSOLECONTROLS table) which contains basic information, such as its CLSID and description, and the information needed for data binding, such as the name of the OLE property to use for the DEFPROP property. The simple form below shows the information that can be held for an OLECONTROL entity //(Note that this form isn't final, right now it's a "bare-bones" version that is being developed further to integrate with the new IDE, but it does allow full testing and validation)//. [caption id="attachment_1106" align="aligncenter" width="470"][[http://revdevx.files.wordpress.com/2013/11/microsoft_web_browser-ole-control.png|{{16761.2922800926_1.png}}]] OLE Control Registration[/caption] **The CLSID** The first, and most critical item of data, is the Class ID (CLSID) of the OLE control, which is a 128-bit number (called a GUID, or Globally Unique IDentifier) that uniquely identifies it. When you install an OLE control onto a system, the CLSID is used as a key in the registry where various bits of information about the control are stored. Older versions of OpenInsight have always required you to enter the CLSID manually when using OLE controls with the Form Designer, and this can be a tedious task if not provided with the control's documentation, usually needing a good trawl through your Windows Registry or a special tool like Microsoft's OLEView to find it. With version 10 we've included a new dialog that does the heavy lifting for you when you want a CLSID: It enumerates all the OLE controls that are installed on your system and presents them as a list for you to choose from, returning the CLSID when you click "OK". [caption id="attachment_1094" align="aligncenter" width="618"][[http://revdevx.files.wordpress.com/2013/11/select-ole-control2.png|{{16761.2922800926_2.png}}]] Select OLE Control[/caption] Once you have specified the CLSID you can save the record without any further input if you wish. The control won't be data-bound but it //will// be added to the tool palette in the Form Designer as a new item so it is readily available for subsequent development purposes. ==== Data-binding OLE controls ==== If you wish to support data-binding the next item to specify is the **DEFPROP** property, which is a "synthetic" property that maps onto a "real" property (such as **TEXT**, **VALUE**, **ARRAY** etc.) at run-time. All data-binding in OpenInsight is handled through the **DEFPROP** property and it is the sole mechanism by which the form IO layer accesses data in the user interface. For an OLE control **DEFPROP** can be mapped in one of two ways: - By specifying an actual OLE property of the control (such as "Text" for example), or, - By specifying the name of a Basic+ handler function that the form IO layer calls to handle the request. This latter method can be useful when dealing with a complex control such as a grid, that might need to insert/delete rows and set cells individually if it doesn't have something like an intrinsic OpenInsight-style **ARRAY** property. If you do specify a Basic+ **DEFPROP** handler function it must conform to the following interface: <code> defPropVal = myDefPropHandler( ctrlEntID, flags, newValue, index ) ctrlEntID -> ID of the control to get the value for flags -> Denotes if this is a GET or SET/SETONLY request newValue -> The new value if this is a SET/SETONLY operation index -> Property index: <1> Col <2> Row </code> Note that the Option ("...") buttons on the form present a popup of OLE properties and events, or matching Stored Procedures, as appropriate: [caption id="attachment_1148" align="aligncenter" width="361"][[http://revdevx.files.wordpress.com/2013/11/select-ole-property.png|{{16761.2922800926_3.png}}]] Selecting an OLE Property for the Web Browser control[/caption] **Binding multi-column (AMV) controls** If your OLE control can support multiple data columns like the standard OpenInsight EditTable, there are two more items needed to allow the form IO layer to understand how to use your control: - The new **DEFPOSPROP** property, and - The name of an OLE event that maps to the equivalent of OpenInsight's **POSCHANGED** event. The **DEFPOSPROP** property is used to access the current column/row/cell position within the control, in a similar fashion to the standard **SELPOS** or **CARETPOS** properties. It can be mapped in one of three ways: - By specifying a //single// actual OLE property of the control (such as "SelPos" for example) that implements an @fm-delimited column and row index format (like **CARETPOS**) - By specifying a comma delimited //pair// of properties representing the column and row positions respectively, e.g. "CurrCol,CurrRow" - By specifying the name of a Basic+ handler function that the form IO layer calls to handle the request in a similar fashion to the **DEFPROP** handler. A Basic+ **DEFPOSPROP** handler should have the following interface: <code> defPosPropVal = myDefPosPropHandler( ctrlEntID, flags, newPos ) ctrlEntID -> ID of the control to get the value for flags -> Denotes if this is a GET or SET/SETONLY request new -> The new position if this is a SET/SETONLY operation <1> Col <2> Row defPosPropVal <- Returns the current position in the format: <1> Col <2> Row </code> The final item needed is the **POSCHANGED** event name so that the form IO layer can check when data has been entered into a cell for validation and update purposes. **Control Semantics** The next set of information is used by the Form Designer to indicate what extra features it needs to present when the OLE control is being edited: * //Allow Data-Binding//: Checking this box tells the Form Designer to allow **TABLE** and **COLUMN** properties to be entered. This //must// be set if you wish to actually bind your control to the database at runtime. * //Required Support//: Checking this box tells the Form Designer to allow the **REQUIRED** property to be specified. * //IConv Support//: Checking this box tells the Form Designer to allow the **VALID** property to be specified. * //Oconv Support//: Checking this box tells the Form Designer to allow the **CONV** property to be specified. **CLICK Event Data-Binding** Some controls, such as Checkboxes, update their data when clicked rather when they lose focus or change cell position. In this case the form IO layer needs to know the name of the OLE event to track if the control exhibits this behavior and this should be entered here. //(Disclaimer: This article is based on preliminary information and may be subject to change in the final release version of OpenInsight 10).// === Comments === ---- === At 20 NOV 2013 05:16PM dbakke wrote: === <QUOTE>Impressive approach toward bringing OLE controls to life in OI. My hats off to Carl and the Revelation team for this. </QUOTE> ---- === At 21 NOV 2013 02:34AM David Tod Sigafoos wrote: === <QUOTE>WOW .. and I almost understood that. There must be some magical bits that only Prop twirlers will understand . Great job Carl of bringing the power to the developer without handcuffing them with yibberyabber </QUOTE> ---- === At 21 NOV 2013 05:42AM dbakke wrote: === <QUOTE>Carl, I also have to ask about the puzzle-piece icons you have on two of the screens that I believe you said were in OI 10. Is that a temporary icon or will that make an appearance in the product? </QUOTE> ---- === At 21 NOV 2013 10:42AM Captain C wrote: === <QUOTE>Hi Don - AFAIK no decisions have been taken about the artwork for v10 yet - I'm currently using icons from the Icon-Experience sets, but we'll see what happens down the road. </QUOTE> ---- === At 01 MAR 2022 06:03PM Alfredo wrote: === <QUOTE>That's what I thought, I appreciate your feedback. BTW Do you know if is there an OCX/ActiveX that I can insert into an OI Form to do some linear graphs(kind of trend/spc)? </QUOTE> ---- === At 03 MAR 2022 01:11AM Captain C wrote: === <QUOTE>TBH I don't - I've seen people use HTML content (Google charts etc) in a webbrowser control for this - you might have better luck asking on the Revelation forum? Regards </QUOTE> ---- === At 01 MAR 2022 05:57PM Captain C wrote: === <QUOTE>Hi Alfredo. I'm afraid a 64-bit process cannot host a 32-bit DLL (OCX) directly - it's a limitation of the architecture and OS. The only way to do something like this is to have the 32-bit OCX hosted in a separated 32-bit process and use some sort of IPC mechanism between this and the 64-bit process (e.g. pipes or TCPIP), but this probably isn't ideal for an OCX that implement visual controls. </QUOTE> ---- === At 01 MAR 2022 05:23PM Alfredo wrote: === <QUOTE>Do you know if an OCX developed in Visual Studio VB6 can work on version 10 of OpenInsight in some way? </QUOTE> == Original ID: revdevx.wordpress.com/?p=1087 == third_party_content/revdevx/16761.2922800926.txt Last modified: 2024/01/29 20:23by 127.0.0.1