It seems like they don't registered.
Am i doing something wrong?
There are no errors, just don't work
Code is really simple:
unit Component1;
interface
uses
System.SysUtils, System.Classes;
type
TTestValue = (AFirst, ASecond);
TTestValues = set of TTestValue;
TComponent1 = class(TComponent)
private
{ Private declarations }
FMySet: TTestValues;
FFiled1: TTestValue;
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
property Field1: TTestValue read FFiled1 write FFiled1;
property MySet: TTestValues read FMySet write FMySet stored false;
end;
implementation
end.
unit untRegUnit;
interface
Uses
Classes, DesignIntf, DesignEditors, Component1;
procedure Register;
implementation
type
TMySetProperty = class(TSetProperty)
public
function GetValue: string; override;
end;
TMyEnumProperty = class(TEnumProperty)
public
function GetValue: string; override;
procedure SetValue(const Value: string); override;
procedure GetValues(Proc: TGetStrProc); override;
end;
{ TMySetProperty }
function TMySetProperty.GetValue: string;
begin
Result := inherited GetValue + '_Test';
end;
{ TMyEnumProperty }
function TMyEnumProperty.GetValue: string;
begin
Result := inherited GetValue + '_Test';
end;
procedure Register;
begin
RegisterComponents('Samples1', [TComponent1]);
// UnlistPublishedProperty(TComponent1, 'Field1');
// UnlistPublishedProperty(TComponent1, 'MySet');
RegisterPropertyEditor(TypeInfo(TTestValues), TComponent1, 'MySet', TMySetProperty);
RegisterPropertyEditor(TypeInfo(Boolean), TComponent1, 'Field1', TMyEnumProperty);
end;
procedure TMyEnumProperty.GetValues(Proc: TGetStrProc);
begin
Proc('111');
Proc('222');
end;
procedure TMyEnumProperty.SetValue(const Value: string);
begin
//inherited;
SetOrdValue(0);
end;
end.