Using the Add method of an Object inherited from an Objectlist

Asked

Viewed 58 times

0

I have a Tprodutovmi class and to be able to better manipulate the information within a list I created the Tprodutovmilist class that inherits from an Objectlist.

But every time having used the ADD method gives the error of "Access Violation". When I cast an Objectlist for my type Tprodutovmilist I can use it normally, even using its functions, but still the ADD method keeps giving error.

TProdutoVMI = class(TEntity)
   private
      FpurchaseDistribuitionProfile: String;
      FsupplierProductId: String;
      FreceiverFiscalId: String;
      FsubrangeId: String;
      FminSalesQuantity: Integer;
      FtimeUpdateVMI: String;
      FproductId: String;
      FprocessBillingType: String;
      FisControlledByBatch: Boolean;
      FsupplierSalesUnitMeasure: String;
      FuserVMI: String;
      FdateUpdateVMI: String;
      Fstore: String;
      FproductEAN: String;
      FsupplierFiscalId: String;
      procedure SetdateUpdateVMI(const Value: String);
      procedure SetisControlledByBatch(const Value: Boolean);
      procedure SetminSalesQuantity(const Value: Integer);
      procedure SetprocessBillingType(const Value: String);
      procedure SetproductEAN(const Value: String);
      procedure SetproductId(const Value: String);
      procedure SetpurchaseDistribuitionProfile(const Value: String);
      procedure SetreceiverFiscalId(const Value: String);
      procedure Setstore(const Value: String);
      procedure SetsubrangeId(const Value: String);
      procedure SetsupplierFiscalId(const Value: String);
      procedure SetsupplierProductId(const Value: String);
      procedure SetsupplierSalesUnitMeasure(const Value: String);
      procedure SettimeUpdateVMI(const Value: String);
      procedure SetuserVMI(const Value: String);
   published
      property store : String read Fstore write Setstore;
      property supplierFiscalId : String read FsupplierFiscalId write SetsupplierFiscalId;
      property subrangeId : String read FsubrangeId write SetsubrangeId;
      property productId : String read FproductId write SetproductId;
      property productEAN : String read FproductEAN write SetproductEAN;
      property isControlledByBatch : Boolean read FisControlledByBatch write SetisControlledByBatch;
      property supplierProductId : String read FsupplierProductId write SetsupplierProductId;
      property minSalesQuantity : Integer read FminSalesQuantity write SetminSalesQuantity;
      property supplierSalesUnitMeasure : String read FsupplierSalesUnitMeasure write SetsupplierSalesUnitMeasure;
      property receiverFiscalId : String read FreceiverFiscalId write SetreceiverFiscalId;
      property purchaseDistribuitionProfile : String read FpurchaseDistribuitionProfile write SetpurchaseDistribuitionProfile;
      property processBillingType : String read FprocessBillingType write SetprocessBillingType;
      property dateUpdateVMI : String read FdateUpdateVMI write SetdateUpdateVMI;
      property timeUpdateVMI : String read FtimeUpdateVMI write SettimeUpdateVMI;
      property userVMI : String read FuserVMI write SetuserVMI;
   end;

   TProdutoVMIList = class(TObjectList<TProdutoVMI>)
   public
      type
         [Automapping]
         TGroupProdutoVMI = class
         strict private
            FsupplierProductId: String;
            FproductId: String;
            procedure SetproductId(const Value: String);
            procedure SetsupplierProductId(const Value: String);
         public
            property productId : String read FproductId write SetproductId;
            property supplierProductId : String read FsupplierProductId write SetsupplierProductId;
         end;
   strict private
      FGroup: TObjectList<TGroupProdutoVMI>;
      function GetGroup: TObjectList<TGroupProdutoVMI>;
   public
      constructor Create;
      destructor Destroy; override;
      property Group : TObjectList<TGroupProdutoVMI> read GetGroup;
   end;
  • Good morning Higor.. everything straight.. Strange even to give access violation.. also did not understand.. but if we do so goes smoothly..: Var A : Integber;Product : Tprodutovmi, Tobjectlist<Tprodutovmi> Begin List:= Tobjectlist<Tprodutovmi>. Create; For A:= 0 to 1 do Begin Product:= Tprodutovmi.Create; List.Add(Product). You will understand... :|

  • It’s really weird, because if I just create an object like Tobjectlist<Tprodutovmi> it works normally. Already when it is a class inherited from a Tobjectlist<Tprodutovmi> I have this problem with the Add method. ;TProdutoVMIList(TObjectList<TProdutoVMI>) Only thus I was able to use the class Tprodutovmilist, since by now my Objectlist is already populated

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.