mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 22:19:18 +02:00
examples: objectinspector: fixed GetOwner
git-svn-id: trunk@49953 -
This commit is contained in:
parent
10280e3488
commit
d962160e3f
@ -6,7 +6,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, TypInfo, LResources, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, TypInfo, LResources, Forms, Controls, Graphics, Dialogs,
|
||||||
ObjectInspector, PropEdits, StdCtrls, Buttons;
|
ObjectInspector, PropEdits, PropEditUtils, StdCtrls, Buttons;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ TMyComponent }
|
{ TMyComponent }
|
||||||
@ -20,6 +20,8 @@ type
|
|||||||
property AnInteger: integer read FAnInteger write SetAnInteger;
|
property AnInteger: integer read FAnInteger write SetAnInteger;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TForm1 }
|
||||||
|
|
||||||
TForm1 = class(TForm)
|
TForm1 = class(TForm)
|
||||||
PropGridGroupbox: TGroupBox;
|
PropGridGroupbox: TGroupBox;
|
||||||
SetCompAsOIRootButton: TButton;
|
SetCompAsOIRootButton: TButton;
|
||||||
@ -32,6 +34,8 @@ type
|
|||||||
procedure SetCompAsOIRootButtonClick(Sender: TObject);
|
procedure SetCompAsOIRootButtonClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
procedure SetObjectInspectorRoot(AComponent: TComponent);
|
procedure SetObjectInspectorRoot(AComponent: TComponent);
|
||||||
|
protected
|
||||||
|
function GetOwner: TPersistent; override;
|
||||||
public
|
public
|
||||||
TheObjectInspector: TObjectInspectorDlg;
|
TheObjectInspector: TObjectInspectorDlg;
|
||||||
ThePropertyEditorHook: TPropertyEditorHook;
|
ThePropertyEditorHook: TPropertyEditorHook;
|
||||||
@ -48,8 +52,8 @@ implementation
|
|||||||
procedure TForm1.Form1Create(Sender: TObject);
|
procedure TForm1.Form1Create(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
// create the PropertyEditorHook (the interface to the properties)
|
// create the PropertyEditorHook (the interface to the properties)
|
||||||
ThePropertyEditorHook:=TPropertyEditorHook.Create;
|
ThePropertyEditorHook:=TPropertyEditorHook.Create(nil);
|
||||||
|
|
||||||
// create the ObjectInspector
|
// create the ObjectInspector
|
||||||
TheObjectInspector:=TObjectInspectorDlg.Create(Application);
|
TheObjectInspector:=TObjectInspectorDlg.Create(Application);
|
||||||
TheObjectInspector.PropertyEditorHook:=ThePropertyEditorHook;
|
TheObjectInspector.PropertyEditorHook:=ThePropertyEditorHook;
|
||||||
@ -105,6 +109,13 @@ begin
|
|||||||
Selection.Free;
|
Selection.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TForm1.GetOwner: TPersistent;
|
||||||
|
begin
|
||||||
|
// this form is the LookupRoot => GetOwner must be nil
|
||||||
|
// see GetLookupRootForComponent
|
||||||
|
Result:=nil;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TMyComponent }
|
{ TMyComponent }
|
||||||
|
|
||||||
procedure TMyComponent.SetAnInteger(const AValue: integer);
|
procedure TMyComponent.SetAnInteger(const AValue: integer);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<Version Value="9"/>
|
<Version Value="9"/>
|
||||||
@ -50,11 +50,5 @@
|
|||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="11"/>
|
<Version Value="11"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<Other>
|
|
||||||
<CompilerMessages>
|
|
||||||
<UseMsgFile Value="True"/>
|
|
||||||
</CompilerMessages>
|
|
||||||
<CompilerPath Value="$(CompPath)"/>
|
|
||||||
</Other>
|
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
</CONFIG>
|
</CONFIG>
|
||||||
|
Loading…
Reference in New Issue
Block a user