I would like to know if there is a way to add custom methods for existing/included class components in Delphi Pascal.
I want to use it to look like Rotate StringGrid like this:
StringGridn.rotate(angle);
Replace:
rotate( StringGridn, angle);
Thank you for your suggestion:)
you can Use the helper in the example below, see Class and Record Helpers (Delphi).
type
TStringGridHelper = class helper for TStringGrid
procedure Rotate(Angle: Single);
end;
procedure TStringGridHelper.Rotate(Angle: Single);
begin
{your implementation }
Rotate (Self, Angle);
end;
Then call
StringGridn.Rotate(Angle);
I want to know if there is a way to add custom methods for existing/included class components in Delphi Pascal.
I want to use it to rotate StringGrid like this :
StringGridn.rotate(angle);
Replace:
rotate(StringGridn, angle );
Thank you for your suggestion:)
You can use the helper in the example below, please refer to Class and Record Helpers ( Delphi).
type
TStringGridHelper = class helper for TStringGrid
procedure Rotate(Angle: Single);
end;
procedure TStringGridHelper. Rotate(Angle: Single);
begin
{your implementation }
Rotate(Self, Angle);
end;
Then call
StringGridn.Rotate(Angle);