Hola Daniel, acabo de probar tu ejemplo en Delphi 2010 y funciona bien
Simplemente no entiendo porque limitas la clase a inspeccionar a que sea heredero de
TComponent
Segun las pruebas que he hecho, funciona bien si heredamos de TObject:
Código Delphi
[-]
TCustomEvent = procedure of object;
TMyClass = class
private
FEvento: TNotifyEvent;
FEventoCustom: TCustomEvent;
procedure SetEvento(const Value: TNotifyEvent);
procedure SetEventoCustom(const Value: TCustomEvent);
published
property Evento: TNotifyEvent read FEvento write SetEvento;
property EventoCustom: TCustomEvent read FEventoCustom write SetEventoCustom;
end;
implementation
uses
TypInfo;
procedure GetMethodNames(AClass: TClass; TS: TStrings);
var
I: Integer;
pInf: PPropList;
begin
for I := 0 to GetPropList(AClass.ClassInfo, pInf) - 1 do
if pInf[i].PropType^.Kind = tkMethod then
TS.Add(Format('%s: %s', [pInf[i].Name, pInf[i].PropType^.Name]));
end;
procedure TForm1.Button1Click(Sender: TObject);
var
TS: TStrings;
begin
TS := TStringList.Create;
try
GetMethodNames(TMyClass, TS);
ShowMessage(TS.Text);
finally
TS.Free;
end;
end;
En este caso imprime tanto el TNotifyEvent como el TCustomEvent. Eso si, fue necesario declarar las propiedades como
publicadas