Board index » delphi » Overloading the OnDragOver Event...

Overloading the OnDragOver Event...

I would like to overload the DragOver procedure of a TPanel component.

I success for the Click procedure with:

MyClass = class(TPanel)
...
   procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
                       X, Y: Integer); override;
...
end;

when i try

MyClass = class(TPanel)
...
   procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
                       X, Y: Integer); override;
   procedure DragOver(Sender, Source: TObject; X, Y: Integer;
                      State: TDragState; var Accept: Boolean); override;
...
end;

M. Compiler tell me:
"Compiler Error 187: Method Does Not Exist in Base Class"

OnDragover isn't a standard event as OnMouseDown?

-Eric-

 

Re:Overloading the OnDragOver Event...


Quote
ebe...@absolu.com (Eric Begin) wrote:
>when i try
<snip>
>   procedure DragOver(Sender, Source: TObject; X, Y: Integer;
>                      State: TDragState; var Accept: Boolean); override;
<snip>
>"Compiler Error 187: Method Does Not Exist in Base Class"
>OnDragover isn't a standard event as OnMouseDown?

No, contrary to the documentation, this won't work. In fact, none of
the drag-and-drop events are available. There was some discussion
regarding this situation a while ago, and the solution (such as it is)
was to make procedures at the Form level, then make all of your objects
point their drag-and-drop events to the appropriate procedures of
the form.

This works fairly well, but I was disappointed that I couldn't
make it part of my components. Just don't forget to hook up the
events, you could spend time trying to debug routines that you
assume are being called, when in fact they are not. I learned this
one the hard way.

Hope this helps.

Reid Abel
University of British Columbia
r...@ares.ubc.ca

Other Threads