Using TStringList.AddObject in Delphi Android FMX

  

I have a FMX TCombobox in my Delphi 10.3.3 app that I’m compiling for Android. I had previously researched the subject and found Using Primitive Types with TStrings in iOS. I downloaded BoxPrimitives.pas and the code below, compiled sucessfully under Delphi 10.3.3.
uses BoxPrimitives;

{$ifdef ANDROID}
cbGender.Items.AddObject(‘Male’, TBoxInteger(1));
cbGender.Items.AddObject(‘Female’, TBoxInteger(0));
{$else}
cbGender.Items.AddObject(‘Male’, TObject(1));
cbGender.Items.AddObject(‘Female’, TObject(0));
{$endif}

Now I’ve opened that source code in Delphi 10.4.1, and the BoxPrimitives.Pas no longer compiles.

[DCC Error] BoxPrimitives.pas(46): E2123 PROCEDURE, FUNCTION,
PROPERTY, or VAR expected

The general question then is: What changed in Delphi 10.4 that’s preventing it from compiling? And more specifically: Is there a way to use AddObject with a TCombobox in Android in Delphi 10.4?

Comments are closed.