Hi,
after reading the post How to set event handlers via new RTTI?, I wonder if it is possible to solve this more dynamically. For example I want to set ALL event handlers of any component to nil.
Using TValue.From <TNotifyEvent> (SomeMethod)
does not work for two reasons:
1. The type is unknown (could be TNotifyEvent, TMouseEvent etc.)
2. I cannot set 'SomeMethod' to nil (invalid cast)
In old RTTI style I would do something like:
var
NilMethod: TMethod;
begin
[...]
NilMethod.Data := nil;
NilMethod.Code := nil;
SetMethodProp (AComponent,PropertyName,NilMethod);