Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Drag/Drop

Any ideas how I might be able to make a cell contents in one table drag/drop to a cell in another table.
Both SRP edit table.
No facility exists, but wondering if there might be some tricky fudge I can do.

Colin

Comments

  • edited March 2017
    As you just noted (and discussed in this post), this would have to be simulated. I would be interested to hear of anybody actually doing this. I think if I were to take a stab at this I would do something like this:
    • Use the OnMouseMove event.
    • Check to see if the Button argument shows the user is pressing down. This will be the beginning of a drag. Set a flag (like a UDP) indicating that a drag attempt is being implemented. Also, use the appropriate property to collect the data you want (e.g., the CellText property of the cell you are hovering over) and save this in a UDP as well.
    • If the OnMouseMove event for the source SRP EditTable ever detects the Button argument being cleared, then consider the drag operation aborted and clear the UDP.
    • Otherwise, in the OnMouseMove event of the target SRP EditTable, keep checking the Button argument. Once it is cleared then this means the user is intending to drop the data. Take the data from your UDP and apply it to the target SRP EditTable. Clear the UDPs.
    What you won't get in this mechanism is a nice visual feedback from the cursor that the drag operation is occurring.
  • I have implemented, only took about 15 lines of code.
    As you say only issue is the cursor, but I just changed to an hourglass, plus highlighted the drop cell SelPos property to show where it is going to go.

    Great stuff.
Sign In or Register to comment.