VFP 9 Manual Drag Drop

Hello Experts.

I have two identical tables, each with a single column. One table is populated with data, the other is empty.

On a form I need to display two grids, one sourced from populated table, and the second with the empty table.

What I would like to do is drag and drop a value from a field in the first grid into the second grid, thereby populating table two with this new value.

I understand VFP9 will not handle this automatically, and that the code will have to be done manually.

This, however, is over my head. Can someone provide me with a sample?
Thx.
formadmirerAsked:
Who is Participating?
 
tusharkanvindeCommented:
Create 2 containers. 1 covering the target grid (container1) and the 2nd covering the full form (container2). send both of them to the back.

in grid1.column1.text1 mousedown event give command
thisform.container2.ZOrder(0)
thisform.container1.ZOrder(0)
this.Drag

in grid1.column1.text1 dragdrop event give command
thisform.container2.ZOrder(1)
thisform.container1.ZOrder(1)

in container2 dragdrop event give command
thisform.container2.ZOrder(1)
thisform.container1.ZOrder(1)

in container1 dragdrop event give command
insert into table2 (FieldName) values (table1.FieldName)
delete in table1
thisform.grid1.refresh
thisform.grid2.refresh
thisform.container2.ZOrder(1)
thisform.container1.ZOrder(1)

Now make both containers transparent and without borders
0
 
formadmirerAuthor Commented:
I am hoping to get the time to attempt what you have suggested a little later today or tomorrow.

To be honest, I'm not that skilled in FP and was hoping for something a little easier, or something I could look at and understand.

I have never over-laid containers on top of grids (or any other control for that matter) before, but I am eager to give it a try and see what happens.
0
 
tusharkanvindeCommented:
Let me know how it goes
0
 
tusharkanvindeCommented:
for the container, just place a container, make its top and left as 0 and height and width as same as the height and width of the form. Then in the format menu, send it to the back

for the other container, make its top and left = top and left of the grid, similarly height and width.
0
 
formadmirerAuthor Commented:
This worked well for my needs. Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.