Adding TFormatSettings?

Hello,

I wanted to use the “FormatSettings” record from SysUtils in a PascalScript. However i am a little bit stuck when i want to add the TFormatSettings type.

Do i have to include the whole record definition when using AddTypeS? What is about the methods that the record contains?

Can you give me an example how to add such more complex types? - Thanks in advance!

Thanks in advance,
Ralf

Just the type. then you need to add methods that actually work with this type.

I tried that but there are problems.

To Register i used:

 lType := CL.AddTypeS('TFormatSettings',
'    record ' +
'    CurrencyString: string; ' +
'    CurrencyFormat: Byte; end' +
'    CurrencyDecimals: Byte; ' +
'    DateSeparator: Char; ' +
'    TimeSeparator: Char; ' +
'    ListSeparator: Char; ' +
'    ShortDateFormat: string; ' +
'    LongDateFormat: string; ' +
'    TimeAMString: string; ' +
'    TimePMString: string; ' +
'    ShortTimeFormat: string; ' +
'    LongTimeFormat: string; ' +
'    ShortMonthNames: array[1..12] of string; ' +
'    LongMonthNames: array[1..12] of string; ' +
'    ShortDayNames: array[1..7] of string; ' +
'    LongDayNames: array[1..7] of string; ' +
'    EraInfo: array of TEraInfo; ' +
'    ThousandSeparator: Char; ' +
'    DecimalSeparator: Char; ' +
'    TwoDigitYearCenturyWindow: Word; ' +
'    NegCurrFormat: Byte; ' +
'    NormalizedLocaleName: string; ' +
'    end'
);

CL.AddVariable(‘FormatSettings’, lType);

However i am not sur if i have to include the class function (there are some of them in that record) too. When i use this record in my code the members of the record are not available:

procedure RunTest;
var
   fs: TFormatSettings;
begin
  fs := FormatSettings;
  WriteLn( 'LongDateFormat = ' + fs.LongDateFormat );
  // Results in "Unknown identifier LONAGDATEFOMAT"
end;

Can you give me a hint what is wrong with the registration?

Thanks in advance,
Ralf

there’s an “end” after CurrentFormat: Byte that shouldn’t be ther.