Drag and Drop in Visual FoxPro

ID: Q147688


The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0


SUMMARY

There are various levels of Drag and Drop that an application can support. FoxPro only supports its application drag and drop, not OLE drag and drop (with the exception of using some OLE Controls).


MORE INFORMATION

When you drag Visual FoxPro objects around, only Visual FoxPro knows about them. OLE is not being used as the mechanism to alert windows that they are being dragged over. This means that you can't drop Visual FoxPro objects outside of Visual FoxPro.

When you drag OLE objects around (any object from an application that supports OLE Drag and Drop), Visual FoxPro does not know about them. This means that you can't drag text from Word and drop it into a Visual FoxPro edit box.

The only time OLE Drag and Drop will happen in a Visual FoxPro form is when an OLE application is in control of the area you are dropping into. If you have an OLE Control on a form, it handles all events for its window, so you can OLE Drag and Drop into it. If you have an in-place active OLE Insertable object in a form, it is handling events, so you can drag and drop into it. In neither case, is a Visual FoxPro DragDrop event fired because Visual FoxPro doesn't know that the drag is happening.

Steps to Demonstrate Behavior

  1. Start Visual FoxPro. Create a new form, and place an OLE Container control on the form.


  2. Add a second OLE Container control to the form, and select Microsoft Excel worksheet.


  3. Place a text box on the form.


  4. Add the following code to the DragDrop event of each control:
    
       Wait Window "<CONTROLNAME> DRAGDROP FIRED" NoWait 


  5. Run the form.


  6. Start Word for Windows or WordPad. Type and select some text. Then drag it to the Visual FoxPro form. Notice that you can't drop the Word object onto the Visual FoxPro form.


  7. Activate the Microsoft Excel OLE Container object, and repeat step 6. Notice that you can now drop into the in-place active Microsoft Excel object. No Visual FoxPro event is fired.


Additional query words: VFoxWin

Keywords : FxinteropOle
Version : 3.00
Platform : WINDOWS
Issue type :


Last Reviewed: August 23, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.