Cobalt747 0 Posted Tuesday at 06:52 PM 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. Share this post Link to post
Remy Lebeau 1674 Posted Tuesday at 07:42 PM (edited) 50 minutes ago, Cobalt747 said: It seems like they don't registered. Am i doing something wrong? There are no errors, just don't work What are you trying to accomplish, exactly? Do the default property editors work correctly without registering your custom editors? 50 minutes ago, Cobalt747 said: RegisterPropertyEditor(TypeInfo(Boolean), TComponent1, 'Field1', TMyEnumProperty); Why are you registering the editor for Boolean instead of TTestValue? Edited Tuesday at 07:43 PM by Remy Lebeau Share this post Link to post
Cobalt747 0 Posted Wednesday at 10:25 AM (edited) del Edited Wednesday at 10:29 AM by Cobalt747 duplicate Share this post Link to post
Cobalt747 0 Posted Wednesday at 10:26 AM Remy, you are right, that was a mistake with Field1. After correction, the property work as planned (just a proof of concept) Anyway, property editor didn't work for Set Share this post Link to post