-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathPropertyEditors.pas
More file actions
58 lines (46 loc) · 1.09 KB
/
PropertyEditors.pas
File metadata and controls
58 lines (46 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
unit PropertyEditors;
interface
uses
DesignIntf, DesignEditors;
type
THeadersProperty = class(TClassProperty)
public
function GetAttributes: TPropertyAttributes; override;
procedure Edit; override;
function GetValue: string; override;
end;
procedure Register;
implementation
uses
Forms, SysUtils, Controls, HttpClasses, UfrmHeadersEditor, TypInfo;
procedure Register;
begin
RegisterPropertyEditor(TypeInfo(THeaders), THttpRequest, 'Headers', THeadersProperty);
end;
{THeadersProperty}
procedure THeadersProperty.Edit;
var
Headers: THeaders;
begin
Headers := THeaders(Pointer(GetOrdValue));
with TFHeadersEditor.Create(Application) do
try
LoadHeaders(Headers);
if ShowModal = mrOk then
begin
SaveHeaders(Headers);
SetOrdValue(Integer(Headers));
end;
finally
Free;
end;
end;
function THeadersProperty.GetAttributes: TPropertyAttributes;
begin
Result := {inherited GetAttributes +} [paDialog];
end;
function THeadersProperty.GetValue: string;
begin
FmtStr(Result, '<%s>', [GetTypeName(GetPropType)]);
end;
end.