Search code examples
delphieventstform

Using another forms event procedure


Is there any way to allow one form to use the event procedures from another form?

E.g. I have a form called PongForm and another called ObstPongForm. There is a ticker on PongForm and another one on ObstPongForm. Is it possible to get ObstPongForm to use the code from PongForm's 'tick' event in it's own 'tick' event? Maybe by letting ObstPongForm inherit from PongForm?


Solution

  • You can simply assign it by code (as long as you have access to both instances):

    ObstPongForm.Ticker.OnTick := PongForm.TickerTick;