Delphi Two methods for OnMessage

-2

In Delphi, is it possible to set two methods for the event OnMessage of TApplication ?

Detail: Both should work simultaneously.

Eg:

TApplication.OnMessage := MetodoA();
TApplication.OnMessage := MetodoB();
    
asked by anonymous 05.11.2018 / 13:57

2 answers

3

In Delphi it is not possible to assign more than one method to the same event. One way to circumvent this deficiency is to make a MetodoAB() and reference it in the event:

procedure MetodoAB();
begin
  MetodoA();
  MetodoB();
end;

TApplication.OnMessage := MetodoAB();
    
05.11.2018 / 14:00
1

Not possible, since event properties are usually a procedure of object, which is basically a pointer to the method. You can create a third method that calls the first two and assign this to the event.

    
05.11.2018 / 13:59