Solved

TCustomControl DragOver Event

Posted on 2007-11-28
3
695 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

691 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