Parts of my stringgrid are eligible drop targets, and some are not (first row is column headings, first column is a sort of index and subsequent columns may be dropped to). I have that coded and working.
Now I am thinking that it might be nice to gve a visual indiation to the user as he drags the mouse over a cell which is a potential drop target. I woudl like to highlight the first cell in the row and column of the cell over which he is currently hovering (or possibly the entire row and column, forming a sort of crosshair; I am as yet undecided). I reckon I can code that in OnDrawCell
.
I had thought to use OnMouseMove
and cehck if Dragging then
, but ...
My problem is that when I am dragging the OnMouseMove
event never gets called.
Is there any other way to know when the cursor is hovering over a strigngrid during a drag operation?
The
OnDragOver event
is specifically designed for doing this; it's called automatically, and provides theX
andY
coordinates where the mouse pointer is located. There's a code sample available at that link location that demonstrates using it as well - it's for aTListBox
, but the principle is the same.