Share via


Implementing Intrinsic and Manual OLE Drag-and-Drop Modes

Visual FoxPro supports two OLE drag-and-drop modes for controls: intrinsic and manual. In intrinsic mode, OLE drag-and-drop operations are handled by Visual FoxPro. In manual mode OLE drag-and-drop operations, you programmatically specify function and control.

Intrinsic OLE drag-and-drop Mode

Intrinsic OLE drag-and-drop mode can be implemented in an application to provide standard OLE drag-and-drop support without any additional programming.

To implement intrinsic OLE drag-and-drop support for a control

  1. Set its OLEDragMode property to 1 – Automatic, allowing the control to act as an OLE drag source.
  2. Set the control's OLEDropMode property to 1 – Enabled, to allow the control to act as an OLE drop target.

For intrinsic OLE drag-and-drop operations, Visual FoxPro determines if the drop target supports the format of the data being dropped on it; if the drop target supports the format, the drop occurs, otherwise the drop is not allowed.

The following table lists the Visual FoxPro controls and the data formats they support as drag sources in intrinsic mode. Note that CF_TEXT is text, such as text you would enter in a text box, and CFSTR_VFPSOURCEOBJECT is an object type reference to a Visual FoxPro control or object. For the controls below that support the CF_TEXT data format, you can drag text from the text portion of the control.

Drag Source Data Formats


Control
Data Format (defined in Foxpro.h)
Container, Image, Line, PageFrame, and Shape CFSTR_VFPSOURCEOBJECT
CommandButton and Label CFSTR_VFPSOURCEOBJECT and CF_TEXT
CheckBox, ComboBox, EditBox, ListBox, Spinner, and TextBox CFSTR_VFPSOURCEOBJECT, CF_TEXT, and CFSTR_OLEVARIANT

The Visual FoxPro controls and data formats they support as drop targets in intrinsic mode are listed in the following table. For the controls listed in this table, you can drop text onto the text portion of the control. The text is inserted at the insertion point.

Drop Target Data Formats

Control Data Format
EditBox and ComboBox (When the ComboBox Style property is set to 0 - Dropdown Combo) CF_TEXT
Spinner and TextBox CFSTR_OLEVARIANT

Manual OLE drag-and-drop Mode

There may be cases where you'd like to control the type of data that can be dropped on a drop target, or provide additional functionality for a drag-and-drop operation. For example, you can convert data to a format supported by the drop target, or you can display a dialog that asks the user to verify that they want to drop the data on the drop target. To override the intrinsic OLE drag-and-drop support and provide greater control over drag-and-drop operations use manual OLE drag-and-drop.

To implement manual OLE drag-and-drop support for a control write your own event or method code for the event or method you want to override. Include the NODEFAULT keyword in the event or method code to override the intrinsic Visual FoxPro drag-and-drop behavior.

Visual FoxPro provides backward compatibility (no OLE drag support) for existing applications when OLEDragMode is set to 0 (the default) and you do not include additional OLE drag-and-drop coding.

See Also

Run-Time OLE Drag-and-Drop Support | Active Documents | Interoperability and the Internet | Design-Time OLE Drag-and-Drop Support | OLE Drag-and-Drop