imagine, you want to assign your own event procedure:
procedure TSuperObject.DoSomething(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ShowMessage('Yes, I am doing');
end;
to any TWinControl on the form. Normally if you have Panel1 (TPanel) on the form, you can do it easy:
Panel1.OnMouseDown:=SuperObject1.DoSomething;
But if you want to do it universally, how can it be accomplished? You can not access protected members of TWincontrol, so intuitive answer:
AnyWinControl.OnMouseDown:=SuperObject1.DoSomething;
simply does not work.
Can it be done by RTTI? How?
Thanx
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…