I've got this code that moves my Main Window around when I drag around MyThingThatDragsIt
procedure TMainForm.ApplicationMessage(var Msg: TMsg; var Handled: Boolean);
var
ScreenPt : TPoint;
DragControl : TControl;
begin
inherited;
if Msg.message = WM_LBUTTONDOWN then
begin
ScreenPt := ScreenToClient(Msg.pt);
DragControl := FindDragTarget(Msg.pt , false);
if Assigned(DragControl) and
((DragControl = MyThingThatDragsIt)
) then
begin
ReleaseCapture;
self.Perform(WM_SYSCOMMAND, SC_MOVE or $0002, 0 );
end;
end
end;
That works OK, but when I let go, my program has lost it's focus and I've got to click once on the form just to click on any other buttons.
Any idea what is wrong here? I followed steps from this question