also gehts um einen PropertyEditor.
Am besten du legst dir erstmal ein neues Form an für deinen Propertyeditor und baust dieses so das es voll funktionsfähig ist. Wenn du dies fertig hast kannst du dann daran gehen das ganze als property-editor zu registrieren.
Delphi-Quellcode:
unit uPropertyEditors;
interface
uses
DesignEditors, DesignIntf, TheUnitOfYourComponent;
type
TYourPropertyEditor =
class(TPropertyEditor)
public
procedure Edit;
override;
function GetAttributes: TPropertyAttributes;
override;
end;
implementation
procedure Register;
begin //If it's an Integer Property
RegisterPropertyEditor(TypeInfo(integer), TYourComponent, '
YourPropertyName', TYourPropertyEditor);
end;
procedure TYourPropertyEditor.Edit;
var LObj: TYourComponent;
LEditForm: TYourEditForm;
begin
if (GetComponent(0)
is TYourComponent)
then
begin
LObj := TYourComponent(GetComponent(0));
//Now You can do something with LObj
//For exampel you can show a form for Editing
{
LEditForm := TYourEditForm.Create(nil);
if LEditForm.ShowModal = mrOK then
begin
LObj.YourPropertyName := EditingForm.Value;
//If the Property has Changed
Self.Designer.Modified;
end;
LEditForm.Free;
}
end;
end;
function TYourPropertyEditor.GetAttributes: TPropertyAttributes;
begin
Result := [paMultiSelect, paDialog, paRevertable];
end;
end.