Using OLE custom controls

You can embed OLE custom controls in Domino® Designer forms and write scripts for them just as you can for a native object. When a control is active (has focus), the menu is a combination of Domino® Designer (File, Applet, and Window) and control items. The control menu items may include one for itself (for example, "Spreadsheet" for a spreadsheet control) and Help--the control help is substituted for Domino® Designer help.

The Applet menu item allows you to do the following:

  • Copy and cut the entire object using the Domino® Designer internal clipboard (use the Edit menu to copy and cut selected text in the object). With the internal clipboard, a Paste operation within Domino® Designer pastes the object, while a Paste Special operation pastes a representation of the object (for example, a picture).
  • Copy externally the entire object using the OLE clipboard. With the OLE clipboard, a Paste Special operation within Domino® Designer or another application allows pasting of the object, while a Paste operation pastes a representation of the object.
  • Access object properties for the control, including the name of the control, sizing, spacing, and style. To access the properties of the control, if supported by the control, choose Edit - Properties.
  • Edit the control events, which brings up the design pane.
  • Set the control mode to design or run.
  • Freeze and unfreeze the control events.

When you embed a control during form design and the control is active, a list of events appears in the Define box in the form design pane. The OLE custom control can raise these events to Domino® Designer and you can write actions against them.

To insert OLE custom controls through the UI

To insert an OLE custom control in a Domino® Designer form or document from the UI, do the following:

  1. Open the form and position the cursor in a rich-text field where you want the control.
  2. Choose Create - Object.
  3. Select "Create a new control."
  4. Select the desired control from the list. The controls are also included in the "Create a new object list"; they are flagged by a symbol with a yellow background. To insert a non-registered control, select Add Control and enter the path of the control file.

To insert OLE custom controls through LotusScript®

To insert an OLE custom control in a Domino® Designer form or document from LotusScript®, use the CreateObject method of NotesUIDocument in one of the form scripts. For example, the following statement might appear in the PostOpen script for the form:

Set Cal = Source.CreateObject("Calendar", _
"MSCAL.Calendar.7")

Source is the NotesUIDocument object for the current document. The second parameter must be the case-sensitive name of a registered OLE object that is an OLE custom control. The first parameter is a reference name that you invent. CreateObject returns a reference variable to the OLE object.

To access an existing control, use the GetObject method of NotesUIDocument in a script attached to the form. For example:

Set Cal = Source.GetObject("Calendar")

To use OLE custom controls in LotusScript®

You can access the properties and methods of an OLE custom control in the same way as you would for a native LotusScript® object. The following example sets the FirstDay property for the calendar control to 2 which is Monday in this case (default is 1, Sunday) where the reference variable is Cal:

Cal.FirstDay = 2

You can examine the properties and methods for registered OLE custom controls in the LotusScript® browser. Look under "OLE Classes."

If you insert an OLE custom control on a form through the UI, the control and its events become available in the Define and Event boxes in the same way as any other object on the form.

An OLE custom control that is NotesFlow-enabled may provide a mechanism for you to handle its events through the ObjectExecute script of a Domino® Designer action, button, or hotspot. This technique would be useful for an OLE custom control that is not inserted on the form.