IDE: designer: before adding a new component check for syntax errors, bug #20512

git-svn-id: trunk@45049 -
This commit is contained in:
mattias 2014-05-16 20:01:56 +00:00
parent 43ebc91b4e
commit 7536a12eb1

View File

@ -13402,8 +13402,14 @@ end;
function TMainIDE.OnPropHookBeforeAddPersistent(Sender: TObject;
APersistentClass: TPersistentClass; AParent: TPersistent): boolean;
var
ActiveSrcEdit: TSourceEditor;
ActiveUnitInfo: TUnitInfo;
Code: TCodeBuffer;
Tool: TCodeTool;
begin
Result:=false;
if (not (AParent is TControl))
and (APersistentClass.InheritsFrom(TControl)) then begin
IDEMessageDialog(lisCodeToolsDefsInvalidParent,
@ -13413,6 +13419,15 @@ begin
UpdateIDEComponentPalette;
exit;
end;
// check for syntax errors in unit interface
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[])
then exit;
Code:=ActiveUnitInfo.Source;
if not CodeToolBoss.Explore(Code,Tool,false,true) then begin
if JumpToCodetoolErrorAndAskToAbort(true)=mrAbort then exit;
end;
Result:=true;
end;