mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-06 22:37:27 +01:00
IDE: designer: before adding a new component check for syntax errors, bug #20512
git-svn-id: trunk@45049 -
This commit is contained in:
parent
43ebc91b4e
commit
7536a12eb1
15
ide/main.pp
15
ide/main.pp
@ -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;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user