How to set custom TidGenerator from DataModeler

There was a small error in sample code.

Here is the working code:

procedure OnClassGenerated(Args: TClassGeneratedArgs);
var
  Attr: TCodeAttributeDeclaration;
  i: Integer;
begin                      
  for I := 0 to Args.CodeType.CustomAttributes.Count - 1 do
  begin
    Attr := Args.CodeType.CustomAttributes[i];
    if Attr.Name = 'Id' then
    begin
      TCodeSnippetExpression(Attr.Arguments[1].Value).Value :=
        'TIdGenerator.Uuid32';
    end;
  end;     

end;

It seems that enabeling 'BBcodes to format post' removes the [i] from the original code