IDE: do not allow putting the frame itself or on of its ancestors onto the frame

git-svn-id: trunk@15562 -
This commit is contained in:
mattias 2008-06-24 15:12:14 +00:00
parent f3ae482691
commit dc35d7411d
2 changed files with 16 additions and 3 deletions

View File

@ -40,12 +40,15 @@ interface
{$ENDIF} {$ENDIF}
uses uses
// FCL + LCL
Classes, SysUtils, Math, LCLProc, LCLType, LResources, LCLIntf, LMessages, Classes, SysUtils, Math, LCLProc, LCLType, LResources, LCLIntf, LMessages,
Forms, Controls, GraphType, Graphics, Dialogs, ExtCtrls, Menus, ClipBrd, Forms, Controls, GraphType, Graphics, Dialogs, ExtCtrls, Menus, ClipBrd,
PropEdits, ComponentEditors, MenuIntf, IDEImagesIntf, // IDEIntf
IDEDialogs, PropEdits, ComponentEditors, MenuIntf, IDEImagesIntf,
// IDE
LazarusIDEStrConsts, EnvironmentOpts, IDECommands, ComponentReg, LazarusIDEStrConsts, EnvironmentOpts, IDECommands, ComponentReg,
NonControlDesigner, FrameDesigner, AlignCompsDlg, SizeCompsDlg, ScaleCompsDlg, TabOrderDlg, NonControlDesigner, FrameDesigner, AlignCompsDlg, SizeCompsDlg, ScaleCompsDlg,
DesignerProcs, CustomFormEditor, TabOrderDlg, DesignerProcs, CustomFormEditor,
ControlSelection, ChangeClassDialog, EditorOptions; ControlSelection, ChangeClassDialog, EditorOptions;
type type
@ -1489,6 +1492,13 @@ var
NewComponentClass:=SelectedCompClass.GetCreationClass; NewComponentClass:=SelectedCompClass.GetCreationClass;
//DebugLn(['AddComponent ',dbgsName(NewComponentClass)]); //DebugLn(['AddComponent ',dbgsName(NewComponentClass)]);
if NewComponentClass=nil then exit; if NewComponentClass=nil then exit;
if LookupRoot.InheritsFrom(NewComponentClass) then begin
IDEMessageDialog(lisInvalidCircle,
Format(lisIsAThisCircleDependencyIsNotAllowed, [dbgsName(LookupRoot),
dbgsName(NewComponentClass), #13]),
mtError,[mbCancel],'');
exit;
end;
// create component and component interface // create component and component interface
NewCI := TComponentInterface(TheFormEditor.CreateComponent( NewCI := TComponentInterface(TheFormEditor.CreateComponent(

View File

@ -3793,6 +3793,9 @@ resourcestring
lisPWNewProject = 'New Project'; lisPWNewProject = 'New Project';
lisPWOpenProject = 'Open Project'; lisPWOpenProject = 'Open Project';
lisPWConvertProject = 'Convert Delphi Project'; lisPWConvertProject = 'Convert Delphi Project';
lisInvalidCircle = 'Invalid circle';
lisIsAThisCircleDependencyIsNotAllowed = '%s is a %s.%sThis circle '
+'dependency is not allowed.';
implementation implementation