Solved

TCustomControl DragOver Event

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

679 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