Board index » delphi » Event Handling for Dynamically Created Components

Event Handling for Dynamically Created Components

Hi,

If I have a bunch of TImage objects that are created on demand
how can I get at each of their event handlers?

any information on dynamic visual object creation / manipulation
would be much appreciated.

thanks in advance
Mark Fynes

 

Re:Event Handling for Dynamically Created Components


Quote
In article <01bc8d1d$7122b800$1326e...@rioja.cs.tcd.ie> "Mark Fynes" <Mark.Fy...@cs.tcd.ie> writes:
>If I have a bunch of TImage objects that are created on demand
>how can I get at each of their event handlers?
>any information on dynamic visual object creation / manipulation
>would be much appreciated.

A component's event-handlers are reached by properties which are pointers to
procedures or functions.  If the property value is non-NIL, the corresponding
procedure is called.

When you create a TImage component and want it to have event handlers, you
need to assign these.  All of the images can point to the same set of
handlers; one of the parms you'll get is a pointer to the object who's calling
you.  (The same is true in design-mode... notice that there's a drop-down list
there as well as the "..." button.)

If you do not assign the event-handlers values, then they will contain NIL and
the VCL code will think that you do not have an event-handler for that event..
which, in fact, you don't.

Other Threads