I know it must be trivial, but I cannot manage to solve it.
I draw some custom drawn items (basically 200x200 px panels containing a TImage), in a ScrollBox so that they are a row. They are placed one above the other and I use the scroll bar to move among them.
The thing is I want to drag and drop them to swap their order. I connect an OnMouseDown and an OnMouseUp event to the items to control this. Everything works fine to know which of them is the one I press the button on, but I cannot know at which position I release the button. Well, the truth is I can guess it using the Y property of OnMouseUp as I know the height of every item, but it only gives me the relative distance in pixels to the starting point, and it might happen that I had released the button out of the ScrollBox so there's no item at that position. After calculating, it would give a wrong item number.
I have tried the OnMouseEnter and OnMouseLeave event of the ScrollBox, but they seem to stop working until the dragging is over.
Is there a simple way to know whether the mouse is within the Top and Bottom bounds of the ScrollBox?
Thanks.