RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TDBLookupList.OnEndDrag Event

Occurs when the dragging of an object ends, either by dropping the object or by canceling the dragging.

Pascal
property OnEndDrag: TEndDragEvent;
C++
__property TEndDragEvent OnEndDrag;

Use the OnEndDrag event handler to specify any special processing that occurs when dragging stops.  

C++ Examples: 

 

/*
This code displays a message in a label named Status. The
message displayed depends on whether the dragged label
control was successfully dropped into and accepted by a
another control.
*/
void __fastcall TForm1::Label1EndDrag(TObject *Sender, TObject *Target, int X,
      int Y)
{
  if (Sender->ClassNameIs("TLabel"))
  {
    AnsiString S = (dynamic_cast<TLabel *>(Sender))->Name + " was dropped and ";
    if (Target)
      S = S + "accepted!";
    else
      S = S + "rejected.";
    Status->Caption = S;
  }
}

 

Delphi Examples: 

{
This code displays a message in a label named Status. The
message displayed depends on whether the dragged label
control was successfully dropped into and accepted by a
another control.
}
procedure TForm1.Label1EndDrag(Sender, Target: TObject; X, Y: Integer);
var
  S: string;
begin
  S := (Sender as TLabel).Name + ' was dropped... and ';
  if Target <> nil then 
    S := S + 'accepted!'
  else 
    S := S + 'rejected!';
  Status.Caption := S;
end;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!