Solved

TCustomControl DragOver Event

Posted on 2007-11-28
3
679 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

760 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

18 Experts available now in Live!

Get 1:1 Help Now