Se la classe viene utilizzata come una proprietà di altri componenti e si desidera utilizzare l'Object Inspector per richiamare la vostra finestra, poi si deve implementare e registrare un costume Editor di proprietà, ad esempio:
interface
uses
DesignIntf, DesignEditors;
type
TMyClassProperty = class(TPropertyEditor)
public
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
end;
procedure Register;
implementation
uses
MyClassUnit;
procedure TMyClassProperty.Edit;
begin
with TMyDialog.Create(nil) do
try
ShowModal;
finally
Free;
end;
end;
function TMyClassProperty.GetAttributes: TPropertyAttributes;
begin
Result := inherited GetAttributes + [paDialog];
end;
procedure Register;
begin
RegisterPropertyEditor(TypeInfo(TMyClass), nil, '', TMyClassProperty);
end;
fonte
2012-01-21 16:30:25
+1 non ho idea del perché qualcuno abbia downvoted una buona domanda –
@David: In qualche modo tutte le recenti domande di Delphi hanno un downvote senza commenti sul perché .. Forse qualcuno non capisce a cosa servono le frecce? :) –