Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drag Grid Textbox to Another Column

Status
Not open for further replies.

Auguy

Programmer
May 1, 2004
1,206
US
I'm trying to set up the ability to drag a text box form one column to another. I don't actually want to move the control, just remember what row/col was dragged and what column it gets dropped in. Each column represents a completion date in a project and there are some other housekeeping chores that need to be done before I complete the move. I only care at this point as to what column it was moved to. I'm close to getting this to work using the Grid DragDrop and Drag methods. I have two questions. Can I use the OleDragDrop methods, etc. and would that be a better way to go? Or, would I be better off trapping the mouse events and do my own drag/drop because this is entirely within the grid?

Auguy
Northwest Ohio
 
You're pretty much always better off using OLE drag-and-drop rather than the native stuff, because it gives you more control over the whole process.

Tamar
 
Auguy,

Yes, I definitely agree with Tamar. And note that you can't mix the two methods. It has to be one or the other. The OLE drag-and-drop technique is the way to go with this.

There's a lot of information on this subject in the VFP Help. Start with the topic "Dragging and Dropping Data", and navigate from there.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thanks to both of you. I have it working with the old DragDrop. Will see if I can re-do with ole.

Auguy
Northwest Ohio
 
Back sooner than I expected. I thought I had the old DragDrop working, but noticed the double click on the textbox is no longer working. I have the DragMode set to Manual and the code to start the drag in the MouseDown event. Is there any way to have both of these working at the same time? Maybe a timer to see if the user has double clicked.

Auguy
Northwest Ohio
 
Ok, thought I had a way around it again. Tried using a timer (enabled in the mousedown event) to see how long the mouse was held down, but the timer doesn't start until the mouse up.

Auguy
Northwest Ohio
 
Switch to OLE drag-and-drop and set the lDetectDrag parameter of OLEDrag to .T. It handles this problem for you automatically.

Tamar
 
Thank You, Thank You, Thank You!

Auguy
Northwest Ohio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top