IDE: method property editor: fixed creating new event

git-svn-id: trunk@55225 -
This commit is contained in:
mattias 2017-06-04 21:55:17 +00:00
parent be678e2bf1
commit 92ef27e2f4
2 changed files with 14 additions and 5 deletions

View File

@ -4600,6 +4600,7 @@ procedure TMethodPropertyEditor.Edit;
}
var
NewMethodName: String;
r: TModalResult;
begin
NewMethodName := GetValue;
{$IFDEF VerboseMethodPropEdit}
@ -4615,10 +4616,14 @@ begin
PropertyHook.ShowMethod(NewMethodName);
end else begin
// the current method is from the another class (e.g. ancestor or frame)
case QuestionDlg('Override or jump',
'The event "'+GetName+'" currently points to an inherited method.',
mtConfirmation,[mrYes,'Create Override',mrOk,'Jump to inherited method',mrCancel],
0) of
if IsValidIdent(NewMethodName) then
r:=QuestionDlg('Override or jump',
'The event "'+GetName+'" currently points to an inherited method.',
mtConfirmation,[mrYes,'Create Override',mrOk,'Jump to inherited method',mrCancel],
0)
else
r:=mrYes;
case r of
mrYes:
begin
// -> add an override with the default name

View File

@ -12772,10 +12772,14 @@ begin
Root:=GlobalDesignHook.LookupRoot;
if Root=nil then exit;
if TObject(Method.Data)=Root then begin
Result:=(Method.Code<>nil) and (Root.MethodName(Method.Code)<>'');
Result:=(Method.Code<>nil) and (Root.MethodName(Method.Code)<>'')
and (Root.ClassParent.MethodName(Method.Code)='');
end else if IsJITMethod(Method) then begin
JITMethod:=TJITMethod(Method.Data);
Result:=Root.ClassType=JITMethod.TheClass;
{$IFDEF VerboseMethodPropEdit}
debugln(['TMainIDE.PropHookMethodFromLookupRoot Root=',DbgSName(Root),' JITMethod.TheClass=',JITMethod.TheClass.ClassName,' Result=',Result]);
{$ENDIF}
end;
end;