This example creates a public method Increase in class TCategories:
procedure OnClassGenerated(Args: TClassGeneratedArgs);
var
Proc: TCodeMemberMethod;
begin
case Args.CodeType.Name of
'TCategories':
begin
Proc := Args.CodeType.AddProcedure('Increase', mvPublic);
Proc.AddParameter('Value', 'Integer').Modifier := pmVar;
Proc.AddParameter('Increment', 'Integer');
Proc.AddSnippet('Value := Value + Increment;');
end;
end;
end;
It will create the following method declaration and implementation:
procedure Increase(var Value: Integer; Increment: Integer);
procedure TCategories.Increase(var Value: Integer; Increment: Integer);
begin
Value := Value + Increment;
end;