I'm having a form with certain components whose are having event handlers. Now I would like to move those event handlers (those methods) to a separate unit still being able to assign them to component events through the Object Inspector at design time.
Is it possible to make a separate unit only for event methods, so that the Object Inspector allows me to assign them at design time ?
Let's say if I would make that unit with a public procedure:
unit Unit2;
interface
procedure ButtonClick(Sender: TObject);
implementation
procedure ButtonClick(Sender: TObject);
begin
// do something here
end;
end.
Or with a class with published method like this:
unit Unit2;
interface
type
TMyClass = class
published
procedure ButtonClick(Sender: TObject);
end;
var
MyClass: TMyClass;
implementation
{ TMyClass }
procedure TMyClass.ButtonClick(Sender: TObject);
begin
// do something here
end;
end.
How to make a separate unit for event methods, which IDE allows me to assign to component events at design time ? Like for instance: