AppWindow.EnableOleDropTarget Method (Typed) | |
Register the window as an OLE drop target.
Namespace:
XSharp.VO.SDK
Assembly:
XSharp.VOGUIClasses (in XSharp.VOGUIClasses.dll) Version: 2.21
Syntax VIRTUAL METHOD EnableOleDropTarget(
lEnable AS LOGIC
) AS VOID
public virtual void EnableOleDropTarget(
[DefaultParameterValueAttribute(true, 0)] bool lEnable
)
Request Example
View SourceParameters
- lEnable
- Type: Logic
A logical value specifying whether to enable (TRUE) or disable (FALSE) the window as a drop target.
Return Value
Type:
TRUE if successful; otherwise, FALSE.
Remarks
A window that is registered as an OLE drop target using AppWindow:EnableOLEDropTarget() can handle OLE drag and drop events and create new OLE objects in response to such events. In the associated handlers, an OLEDragEvent object is passed as a parameter that can be used to create a new OLE object by calling OLEObject:CreateFromOLEDragEvent().
Examples
The following code enables a data window as a drop target and creates a new OLE object inside its OLEDrop handler. It also checks the name of the OLE object to allow only WordPad documents:
1METHOD EnableOLEDropTarget CLASS DropTargetDataWindow
2SELF:EnableOLEDropTarget(TRUE)
3METHOD OLEDrop(oOLEDragEvent) CLASS MyChild
4LOCAL oOLE AS OLEObject
5LOCAL lRet AS LOGIC
6IF oOLEDragEvent:ObjectName == "WordPad Document"
7oOLE := OLEObject{SELF}
8oOLE:AllowInPlace := TRUE
9oOLE:AllowResize := TRUE
10IF oOLE:CreateFromOLEDragEvent(oOLEDragEvent)
11oOLE:Origin := oOLEDragEvent:Position
12oOLE:Show()
13oOLE:SetFocus()
14ENDIF
15ENDIF
See Also