examples: objectinspector: fixed GetOwner

git-svn-id: trunk@49953 -
This commit is contained in:
mattias 2015-10-06 10:11:38 +00:00
parent 10280e3488
commit d962160e3f
2 changed files with 15 additions and 10 deletions
examples/objectinspector

View File

@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils, TypInfo, LResources, Forms, Controls, Graphics, Dialogs,
ObjectInspector, PropEdits, StdCtrls, Buttons;
ObjectInspector, PropEdits, PropEditUtils, StdCtrls, Buttons;
type
{ TMyComponent }
@ -20,6 +20,8 @@ type
property AnInteger: integer read FAnInteger write SetAnInteger;
end;
{ TForm1 }
TForm1 = class(TForm)
PropGridGroupbox: TGroupBox;
SetCompAsOIRootButton: TButton;
@ -32,6 +34,8 @@ type
procedure SetCompAsOIRootButtonClick(Sender: TObject);
private
procedure SetObjectInspectorRoot(AComponent: TComponent);
protected
function GetOwner: TPersistent; override;
public
TheObjectInspector: TObjectInspectorDlg;
ThePropertyEditorHook: TPropertyEditorHook;
@ -48,8 +52,8 @@ implementation
procedure TForm1.Form1Create(Sender: TObject);
begin
// create the PropertyEditorHook (the interface to the properties)
ThePropertyEditorHook:=TPropertyEditorHook.Create;
ThePropertyEditorHook:=TPropertyEditorHook.Create(nil);
// create the ObjectInspector
TheObjectInspector:=TObjectInspectorDlg.Create(Application);
TheObjectInspector.PropertyEditorHook:=ThePropertyEditorHook;
@ -105,6 +109,13 @@ begin
Selection.Free;
end;
function TForm1.GetOwner: TPersistent;
begin
// this form is the LookupRoot => GetOwner must be nil
// see GetLookupRootForComponent
Result:=nil;
end;
{ TMyComponent }
procedure TMyComponent.SetAnInteger(const AValue: integer);

View File

@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
@ -50,11 +50,5 @@
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Other>
<CompilerMessages>
<UseMsgFile Value="True"/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</CONFIG>