Stefan's Corner

 
Example of UserDefined property - Strings in TStrings (and all descendants) class:

interface

uses
  ssProperties;

type
  TssPropStringsText = class(TssCustomProperty)
  protected
    function GetValue(Dest: TObject): string; override;
    procedure SetValue(Dest: TObject; const Value: string); override;
  end;

implementation

{ TssPropStringsText }

function TssPropStringsText.GetValue(Dest: TObject): string;
begin
  Result := TStrings(Dest).CommaText;
end;

procedure TssPropStringsText.SetValue(Dest: TObject; const Value: string);
begin
  TStrings(Dest).CommaText := Value;
end;

initialization

  KeepPropsRegisterCustomProperty(TssPropStringsText.Create(TStrings, 'Text', 'TEXT', tkString));

end.


visits since 15/May/1999

Copyright © 1999, Stefan Stefanov, last updated 20 Септември 1999