Delphi7: PageControl MouseMove while drag and dropping on it
I have the following problem.
There's a pagecontrol on my form and I want to activate a certain tabsheet and then drag and drop (from explorer) to a scrollbox on the tabsheet. (each tabsheet has a scrollbox)
I have code to activate a tab when you mousemove over the pagecontrol. (see code below) The problem is that when I drag a file from explorer the mousemove never fires when I hover/mousemove over the pagecontrol while still dragging.
Also tried to set DragAcceptFiles(pagecontrol.Handle,true);
but that also doesn't help.
procedure TForm2.PageControlMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
var
tabindex : Integer;
begin
tabindex :=开发者_JAVA百科 PageControl.IndexOfTabAt( X, Y );
PageControl.ActivePageIndex := tabindex;
end;
Any ideas/solutions guys and girls?
Thanks.
SoulBlade
With DragAcceptFiles()
you don't get the necessary information, only when data is finally dropped onto the drop target will a WM_DROPFILES
message be sent to the window handle registered with DragAcceptFiles()
.
If you use OLE drag and drop you will get much more control. The Drag and Drop Component Suite for Delphi by Anders Melander implements everything in an easy to install set of components. Use any of the drop target objects, set its Target
property to the pagecontrol on which you want to drop, and use its OnDragOver
event to activate the correct tabsheet.
精彩评论