Solved

TCustomControl DragOver Event

Posted on 2007-11-28
3
680 Views
Last Modified: 2013-11-23
I am trying to teach myself drag'n'drop in Delphi and have created a component (TMyControl) which is a descendant of TCustomControl and have published the OnDragOver event:

TMyControl = class(TCustomControl)
:
  private
    { Private declarations }
    FOnDragOver: TDragOverEvent;
:
  published
    { Published declarations }
    property OnDragOver: TDragOverEvent read FOnDragOver write FOnDragOver;
:
end;

I have written code for MyControl1DragOver:

procedure TForm1.MyControl1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
begin
:
  // some code in here just to prove it works
:
end;

But, this event does not fire when I drag something over MyControl1.

What more should I do to get MyControl1 to fire its DragOver event?
0
Comment
Question by:plumothy
  • 2
3 Comments
 
LVL 26

Accepted Solution

by:
EddieShipman earned 500 total points
ID: 20368895
Put a breakpoint in TWinControl.CMDrag and see if it breaks there.
0
 

Author Comment

by:plumothy
ID: 20370003
Yes, it breaks in TWinControl.CMDrag when dragging over the control.

Thanks for that. I am quickly learning a lot about drag and drop!

I have followed the code execution in the debugger and can see where I have gone wrong.

I had a second control contained in MyControl1and it was this second control which fires its DragOver event - not MyControl1.

Once again, thanks for pointing me in the right direction.
0
 

Author Closing Comment

by:plumothy
ID: 31411407
The solution pointed me in the right direction so I quickly found out what I had done wrong!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now