Class TFindTarget (unit FindTarg)

Inherits from

TComponent

Highlight with blinking Drop control(s) at form(s) when Drag&Drop operation took place. As a responce at message WM_LBUTTONDOWN, the application hook scans all controls for assigned OnDragOver and send to them OnDragOver message with Source object which lies at cursor and X,Y=-1,-1. Case returned value of CanAccept=True the control is included in list and becomes blinking to show anyone drag target. Using: simple put the component at main form. OnDragOver procedures of controls have to set appropriate value CanAccept with X,Y drag point= -1,-1. FreeWare. No warranties. If one will distribute the source code, reference on author (below) is required. If one will modify the source code, highlighting (by any means) of modifications is required. Author: Sergei Trepalin E-mail: trep@trep.home.chg.ru

Constructors


constructor Create(AOwner:TComponent);

Public declarations

-----------------------------------------------------------------------------



Functions

destructor Destroy;


procedure DragEnd(Sender,Target:TObject; X,Y:Integer);

PaintControls;

procedure DragStart(Sender:TObject; var DragObject:TDragObject);


procedure AppMessage(var Msg:TMsg; var Handled:boolean);

Protected declarations

function GetQuant:integer;


procedure HookDrag(Control:TControl);

Release OnStartDrag,OnEndDrag for FDragControl

TMyControl(FDragControl).


procedure OnTimer(Sender:TObject);

Stores OnEndDrag for FDragControl

Windowed control - inverse all window


procedure PaintControls;

FControlStartDrag:=TMyControl(Control).

procedure SetQuant(Value:integer);

Frequency of FDragControl highlighting change

procedure UnhookDrag;


Properties

property EndDragNotify : TNotifyEvent


property StartDragNotify : TNotifyEvent

Published declarations

property TimeQuant : integer


Events

Variables

FAppEvent : TMessageEvent;

Private declarations

FCanvas : TCanvas;


FControlEndDrag : TEndDragEvent;

Stores OnStartDrag for FDragControl

FControlStartDrag : TStartDragEvent;

Any can store own notifications in the methods

FDragControl : TControl;


FDropList : TList;

Stores current control which was started to drag

FEndDrag : TNotifyEvent;


FIsInverted : boolean;


FStartDrag : TNotifyEvent;


FTickCount : integer;

Has TRUE if targets are inverted

FTimer : TTimer;

Possible trget for dragging control


Constructors


constructor Create(AOwner:TComponent);

Public declarations

-----------------------------------------------------------------------------


Functions


destructor Destroy;


procedure DragEnd(Sender,Target:TObject; X,Y:Integer);

PaintControls;


procedure DragStart(Sender:TObject; var DragObject:TDragObject);


procedure AppMessage(var Msg:TMsg; var Handled:boolean);

Protected declarations


function GetQuant:integer;


procedure HookDrag(Control:TControl);

Release OnStartDrag,OnEndDrag for FDragControl

TMyControl(FDragControl).OnStartDrag:=FControlStartDrag; TMyControl(FDragControl).OnEndDrag:=FControlEndDrag;


procedure OnTimer(Sender:TObject);

Stores OnEndDrag for FDragControl

Windowed control - inverse all window


procedure PaintControls;

FControlStartDrag:=TMyControl(Control).OnStartDrag; FControlEndDrag:=TMyControl(Control).OnEndDrag; TMyControl(Control).OnStartDrag:=DragStart; TMyControl(Control).OnEndDrag:=DragEnd;


procedure SetQuant(Value:integer);

Frequency of FDragControl highlighting change


procedure UnhookDrag;


Properties


property EndDragNotify : TNotifyEvent


property StartDragNotify : TNotifyEvent

Published declarations


property TimeQuant : integer


Events


Variables


FAppEvent : TMessageEvent;

Private declarations


FCanvas : TCanvas;


FControlEndDrag : TEndDragEvent;

Stores OnStartDrag for FDragControl


FControlStartDrag : TStartDragEvent;

Any can store own notifications in the methods


FDragControl : TControl;


FDropList : TList;

Stores current control which was started to drag


FEndDrag : TNotifyEvent;


FIsInverted : boolean;


FStartDrag : TNotifyEvent;


FTickCount : integer;

Has TRUE if targets are inverted


FTimer : TTimer;

Possible trget for dragging control