Einzelnen Beitrag anzeigen

Fritzew

Registriert seit: 18. Nov 2015
Ort: Kehl
678 Beiträge
 
Delphi 11 Alexandria
 
#2

AW: TFDCommand : Überschreiben von Properties der Elternklasse

  Alt 25. Sep 2021, 18:05
Da der Setter private ist greife auf das geerbte property zu:

Delphi-Quellcode:
procedure TFlexCommand.SetCommandText(const Value: string);
var
  tempLst: TStringList;
begin
  tempLst := TStringList.Create;
  try
    tempLst.CommaText := Value;
     // Self.SetCommandTextStrs (tempLst); (1)
     inherited CommandText := tempLst; //(1)

    // FCommandText.SetStrings(tempLst) (2)

  finally
    tempLst.Free
  end;

end;

Ich würde auch die Verebung von TFDCustomCommand machen also:

Delphi-Quellcode:
  TFlexCommand = class(TFDCustomCommand)
  private
    procedure SetCommandText(const Value: string);
  public
    property CommandText: string write SetCommandText;
  end;
So kannst Du besser festlegen was als published deklariert wird
Fritz Westermann
  Mit Zitat antworten Zitat