Articles Reduxe: Using Drag and Drop In Visual FoxPro and SAPI

I just posted a few older articles online about Speech Integration and Using Drag/Drop in VFP.

I recently had to revisit the Drag/Drop article (originally written in 2001). 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."

Andrew's White Papers


Popular Posts