Drag and Drop in Visual FoxPro

Last reviewed: February 28, 1996
Article 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 reference words: 3.00 VFoxWin
KBCategory: kbinterop
KBSubcategory: FxinteropOle


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 28, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.