From 92ef27e2f4b534c8e0c5bb9c745ee93941c4c377 Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 4 Jun 2017 21:55:17 +0000 Subject: [PATCH] IDE: method property editor: fixed creating new event git-svn-id: trunk@55225 - --- components/ideintf/propedits.pp | 13 +++++++++---- ide/main.pp | 6 +++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/components/ideintf/propedits.pp b/components/ideintf/propedits.pp index c8bd16e9b4..adcad6bda1 100644 --- a/components/ideintf/propedits.pp +++ b/components/ideintf/propedits.pp @@ -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 diff --git a/ide/main.pp b/ide/main.pp index e49f30ba37..b82af692b2 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -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;