Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Using provider mode: TPriceList

  1. Base class structure

  2. TPriceList

  3. TUserDataSource

  4. Creating columns

  5. Full code

#2. TPriceList

The implementation of the TPriceList class is simple. An empty list is created in the constructor. The Add method adds a new record and initializes it with specified parameters.

{ TPriceList }
constructor TPriceList.Create;
begin
  FRecords := TList.Create;
end;
destructor TPriceList.Destroy;
begin
  Clear;
  FRecords.Free;
  inherited Destroy;
end;
procedure TPriceList.Add(ADescription: string; AOnHand: Integer; APrice: Currency);
var
  P: PListEntry;
begin
  New(P);
  FRecords.Add(P);
  P^.Description := ADescription;
  P^.OnHand := AOnHand;
  P^.Price := APrice;
end;
procedure TPriceList.Clear;
begin
  while FRecords.Count > 0 do
  begin
    Dispose(PListEntry(FRecords[FRecords.Count - 1]));
    FRecords.Delete(FRecords.Count - 1);
  end;
end;

The next section shows the implementation of the TUserDataSource class.

See Also