OLE control events and functions


event = func_id

The name of the function to be called when an event occurs for the control.

When the event is a standard event supported by Sculptor, the function is called as follows:

func_id(event_code, ole_ctrl_id)

In an OLE event function a value may be returned to the OLE control using the syntax:

return Sculptor_value, OLE_value

See Event codes for a list of the standard event codes available.

See Event function return values for Sculptor return values.


EXAMPLES

OleEventFunc(EV_CREATE, OleWordPad)
OleEvent(EV_GAIN_FOCUS, OleCal)

The following function is the event function for a slider control:

!function evSlider(EventCode, Object, strInter, strMethod, Arg1) {

     if (EventCode <> EV_OLE_EVENT) return

     switch (strInter) {
     case == "ISliderEvents":

          switch (strMethod) {
          case == "Click":
               strText = Slider->"Value"
               display txtText
               break
          }
     break
     }
}

Interfaces

Other events supported or generated by the control are grouped into sets, each set being known as an interface. Many OLE controls have only one interface. These events are passed to the event function as follows:

func_id(EV_OLE_EVENT, ole_ctrl_id, interface, event, …)

The interface is the interface name; the event is the name of the event within the specified interface. Both interface and event are text values.

Further arguments may be passed, depending on the event.


Property notifications

Other types of event generated by OLE controls are property notifications. These have the following arguments:

func_id(EV_REQUEST_EDIT, ole_ctrl_id, prop_name, disp_id)

func_id(EV_PROPERTY_CHANGED, ole_ctrl_id, prop_name, disp_id)

The prop_name is the name of the property that has changed; the disp_id is a unique number identifying that property.

If the prop_name is empty (“”), this indicates that more than one property of the control has changed. If this happens, no disp_id is provided.

The EV_REQUEST_EDIT event is a notification that a “requestedit” property is about to change; the control is requesting permission to proceed. The function should return OKAY to allow the change, or ERROR to prevent the change.

The EV_PROPERTY_CHANGED event is a notification that a “bindable” property has changed.

If the OLE control’s own documentation indicates that an event function parameter can be changed, a new value can be assigned to the parameter. The OLE control that generated the event will detect the change.

The program should not execute prompts, dialogs or any other interactive command inside an OLE event function. Executing such commands can interfere with the normal working of the OLE control, and may cause recursion.


RELATED TOPICS

OLE controls

Event functions