HintProperty폼의 유닛 파일에 아래와 같이 THintProperty 클래스를 선언한다.
THintProperty = class(TStringProperty)
public
function GetAttributes: TPropertyAttributes; override;
procedure Edit; override;
end;
Procedure THintProperty.Edit;
Begin
with THintProperty.Create(nil) do
begin
try
Memo1.Lines:=TStrings(GetOrdValue);
if ShowModal=mrOK then
SetOrdValue(Longint(Memo1.Lines));
finally
Free;
end;
end;
end;
function THintProperty.GetAttributes : TPropertyAttributes;
begin
Result:= inherited GetAttributes + [paDialog];
end;
procedure Register;
begin
RegisterPropertyEditor(TypeInfo(string), TControl, 'Hint', THintProperty);
end;
THintProperty = class(TStringProperty)
public
function GetAttributes: TPropertyAttributes; override;
procedure Edit; override;
end;
Procedure THintProperty.Edit;
Begin
with THintProperty.Create(nil) do
begin
try
Memo1.Lines:=TStrings(GetOrdValue);
if ShowModal=mrOK then
SetOrdValue(Longint(Memo1.Lines));
finally
Free;
end;
end;
end;
function THintProperty.GetAttributes : TPropertyAttributes;
begin
Result:= inherited GetAttributes + [paDialog];
end;
procedure Register;
begin
RegisterPropertyEditor(TypeInfo(string), TControl, 'Hint', THintProperty);
end;