fixed menu item method creation on change form on the fly

git-svn-id: trunk@4792 -
This commit is contained in:
mattias 2003-11-10 18:36:20 +00:00
parent e2c9774274
commit 16f0cc169f
3 changed files with 19 additions and 14 deletions

View File

@ -419,15 +419,19 @@ procedure TDefaultComponentEditor.Edit;
var
Components: TComponentSelectionList;
PropertyEditorHook: TPropertyEditorHook;
NewLookupRoot: TComponent;
begin
PropertyEditorHook:=nil;
if not GetHook(PropertyEditorHook) then exit;
Components := TComponentSelectionList.Create;
NewLookupRoot:=GetLookupRootForComponent(Component);
if NewLookupRoot<>PropertyEditorHook.LookupRoot then
GetDesigner.SelectOnlyThisComponent(Component);
FContinue := True;
Components.Add(Component);
FFirst := nil;
FBest := nil;
Components := TComponentSelectionList.Create;
try
Components.Add(Component);
GetComponentProperties(Components, tkAny, PropertyEditorHook,
@CheckEdit, nil);
if FContinue then

View File

@ -1016,7 +1016,7 @@ type
procedure ShowMethod(const Name:ShortString);
function MethodFromAncestor(const Method:TMethod):boolean;
procedure ChainCall(const AMethodName, InstanceName,
InstanceMethod:ShortString; TypeData:PTypeData);
InstanceMethod:ShortString; TypeData: PTypeData);
// components
function GetComponent(const Name: ShortString):TComponent;
function GetComponentName(AComponent: TComponent):ShortString;
@ -1126,6 +1126,8 @@ type
OnRefreshPropertyValues: TPropHookRefreshPropertyValues);
end;
function GetLookupRootForComponent(AComponent: TComponent): TComponent;
//==============================================================================
{ TPropInfoList }
@ -4995,6 +4997,12 @@ var
//******************************************************************************
function GetLookupRootForComponent(AComponent: TComponent): TComponent;
begin
Result:=AComponent;
if (Result<>nil) and (Result.Owner<>nil) then Result:=Result.Owner;
end;
Function ClassTypeInfo(Value: TClass): PTypeInfo;
begin
Result := PTypeInfo(Value.ClassInfo);

View File

@ -671,19 +671,12 @@ begin
end;
procedure TCustomFormEditor.SetSelectedComponents(
TheSelectedComponents : TComponentSelectionList);
TheSelectedComponents: TComponentSelectionList);
begin
FSelectedComponents.Assign(TheSelectedComponents);
if FSelectedComponents.Count>0 then
begin
if FSelectedComponents[0].Owner<>nil then
begin
Obj_Inspector.PropertyEditorHook.LookupRoot:=FSelectedComponents[0].Owner;
end
else
begin
Obj_Inspector.PropertyEditorHook.LookupRoot:=FSelectedComponents[0];
end;
if FSelectedComponents.Count>0 then begin
Obj_Inspector.PropertyEditorHook.LookupRoot:=
GetLookupRootForComponent(FSelectedComponents[0]);
end;
Obj_Inspector.Selections := FSelectedComponents;
end;