Recent

Author Topic: [Solved] OnMouseDown Event  (Read 9352 times)

T-bear

  • Full Member
  • ***
  • Posts: 160
[Solved] OnMouseDown Event
« on: April 03, 2011, 05:58:50 pm »
Hi, i have a little problem with setting the OnMouseDown event of a TImage created at runtime.
---
The procedure itself:
Code: [Select]
procedure TForm1.ImageMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: integer);
begin

end;

The code to set the event of the Timage:
Code: [Select]
E[Counter].Image.OnMouseDown:= @Form1.MouseDown;

And at last the part where the procedure is defined
Code: [Select]
procedure ImageMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: integer);

I get the error "unit1.pas(90,40) Error: Incompatible types: got "<procedure variable type of procedure(TMouseButton, TShiftState, LongInt, LongInt) of object;Register>" expected "<procedure variable type of procedure(TObject, TMouseButton, TShiftState, LongInt, LongInt) of object;Register>"
" in the message window.

What have i done wrong.
Windows XP
Lazarus: 0.9.28.2 Beta
FPC:      2.2.4

Can someone help me.

Thanks!  :D
« Last Edit: April 03, 2011, 06:06:42 pm by T-bear »

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: OnMouseDown Event
« Reply #1 on: April 03, 2011, 06:04:21 pm »
Probably here:

Code: [Select]
E[Counter].Image.OnMouseDown:= @Form1.ImageMouseDown;

T-bear

  • Full Member
  • ***
  • Posts: 160
Re: OnMouseDown Event
« Reply #2 on: April 03, 2011, 06:06:20 pm »
Thank you.  :D

 

TinyPortal © 2005-2018