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}
uses
// FCL + LCL
Classes, SysUtils, Math, LCLProc, LCLType, LResources, LCLIntf, LMessages,
Forms, Controls, GraphType, Graphics, Dialogs, ExtCtrls, Menus, ClipBrd,
PropEdits, ComponentEditors, MenuIntf, IDEImagesIntf,
// IDEIntf
IDEDialogs, PropEdits, ComponentEditors, MenuIntf, IDEImagesIntf,
// IDE
LazarusIDEStrConsts, EnvironmentOpts, IDECommands, ComponentReg,
NonControlDesigner, FrameDesigner, AlignCompsDlg, SizeCompsDlg, ScaleCompsDlg, TabOrderDlg,
DesignerProcs, CustomFormEditor,
NonControlDesigner, FrameDesigner, AlignCompsDlg, SizeCompsDlg, ScaleCompsDlg,
TabOrderDlg, DesignerProcs, CustomFormEditor,
ControlSelection, ChangeClassDialog, EditorOptions;
type
@ -1489,6 +1492,13 @@ var
NewComponentClass:=SelectedCompClass.GetCreationClass;
//DebugLn(['AddComponent ',dbgsName(NewComponentClass)]);
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
NewCI := TComponentInterface(TheFormEditor.CreateComponent(

View File

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