Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Drag & Drop in a Grid
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Drag & Drop in a Grid
Miscellaneous
Thread ID:
00088798
Message ID:
00088798
Views:
63
I want to allow an operator to change the order of items in a grid (rows, not columns) through drag and drop. So I added a column at the far left with a button in it, just to give them a visual handle to grab; I am able to identify the active record when they do grab the handle (because the record is clicked on), but so far as I can tell that stays the active record even when the drop occurs.

So my question is, is there any easy way (or any way at all) to tell when I am over a different record, and if so, which record that is?

It seems that one cannot make a textbox (or some other control within a column) the target; it has to be the grid as a whole. Code to respond to DragOver in a column control does not fire whether or not there is similar code in the grid's DragOver. But then this means that there is no way to recognize the number of times the DragOver has fired (which would give a count of rows to skip).

It occurs to me that I could do some pretty complex math involving the distance moved (based on starting and dropping YCoords) and the RowHeight of the grid, but how does one cope with fractions of a row (e.g. a move of two rows could be anywhere from 19 to 34 -- assuming a row height of 17, and a move of 25 could be either one or two rows depending on where in the first row it starts).

Has anyone ever done anything like this or should I give up and find another way?

Any help would be greatly appreciated

Reg

Thanks,

Reg
Next
Reply
Map
View

Click here to load this message in the networking platform