Skip to main content

Using Drag and Drop In Visual FoxPro

I recently had to revisit this article (originally written in 2001) for a more recent project.

I was implementing drag/drop but it also had to co-exist with a right-mouse click and a Double-click event that were pulling up Visual FoxPro forms.

The objects being used weren't ActiveX controls but regular FoxPro controls, but if you use the standard DragMode and Drag events in the VFP base classes, they conflict with the Double-click and right-click events.

The solution? Use the OLE Drag and Drop.

Now one thing that's not mentioned in this article is a property called CreateDragImage. That's a property Windows uses often with ListView controls to create that shaded image that appears under the cursor when it's being dragged. Sadly, that function doesn't work properly with Visual FoxPro so you have to build your own cursor or icon to make it look right.

This is one of those things where the FoxTeam at Microsoft might want to look for ideas for Visual FoxPro 10. Why? Because these are the little things that work in other environments but don't work in VFP that bug the FoxPro developers. There may be a hundred (valid!) reasons for it and it would take an army to figure them all out but they always cause those little moments where people go "damn! - why doesn't this work."

Using Drag and Drop In Visual FoxPro

Comments

Popular posts from this blog

Prototyping Applications with Sketchflow

How many times have you needed to present visual concepts behind your application to a client?

Over the years, I've had several times where I had to build a quick mock-up in Visual FoxPro to show how an application or function might run. Designing the screens themselves weren't the challenge - the challenge was showing the user how the application would flow between different areas. Short of putting fake code into buttons or saying "and now we go here", there really hasn't been an easy way to do this.

Now, sometimes, a client has gone so far as to hire someone to build "wireframes" to depict this. I found this process an entire waste of time. People building wireframes tend to be "business analysts", in short; people who have stopped learning how to develop code but still want to show their value by being the translator between the client and the developer. As far as I'm concerned, if you want to be a senior developer, you need to be able to…