Re: Why is onclick event firing here?




Brad Blanchard wrote:
Alanglloyd@xxxxxxx wrote:

Code ...

imgarray[num].OnClick := SetImgClicks;

I woud have thought you ought to have got a compile error.

I did and do get an 'Incompatible types' compiler error when I try
your above suggestion. And that's why I'm so miserably stuck right now!
I've been through the Help, through Google Groups, etc, and I don't
know what to look at now.

That's because SetImageClicks is not of TNotifyEvent type.

You have ...

function TMainForm.SetImgClicks(URLIndex : integer) : TNotifyEvent;

TNotifyEvent is ...

procedure(Sender: TObject) of object;

Your "event" is ...

function(URLIndex : integer) : TNotifyEvent of object;

Alan Lloyd

.



Relevant Pages

  • Basic stupidity Java generics
    ... "incompatible types" compile error and I don't know why. ... public interface IContainer<TYPE extends IThing> { ... public class Thing implements IThing { ...
    (comp.lang.java.programmer)
  • Re: Basic stupidity Java generics
    ... I spend two hours before posting the ... "incompatible types" compile error and I don't know why. ... $ javac Test.java ...
    (comp.lang.java.programmer)