From de888c86b38a9e1d01a8e153cfd8a2de4a6f7a8e Mon Sep 17 00:00:00 2001 From: mattias Date: Thu, 30 Mar 2006 09:41:46 +0000 Subject: [PATCH] FCL TComponent.ValidateRename is case sensitive. Added case insensitive check in TDesigner git-svn-id: trunk@9047 - --- designer/designer.pp | 23 ++++++++++++++++++++++- ide/lazarusidestrconsts.pas | 2 ++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/designer/designer.pp b/designer/designer.pp index c1cd677c54..a5744d0436 100644 --- a/designer/designer.pp +++ b/designer/designer.pp @@ -1966,7 +1966,28 @@ end; procedure TDesigner.ValidateRename(AComponent: TComponent; const CurName, NewName: string); -Begin + + procedure RaiseInvalidName(ConflictComponent: TComponent); + begin + raise EComponentError.Create(Format( + lisDesThereIsAlreadyAnotherComponentWithTheName, ['"', + ConflictComponent.Name, '"'])); + end; + +var + i: Integer; + CurComponent: TComponent; +begin + // check, if there is already such a component + for i:=0 to FLookupRoot.ComponentCount-1 do begin + CurComponent:=FLookupRoot.Components[i]; + //DebugLn('TDesigner.ValidateRename ',CurComponent.Name,' ',NewName); + if (CurComponent<>AComponent) + and (CompareText(CurComponent.Name,NewName)=0) then begin + RaiseInvalidName(CurComponent); + end; + end; + // check if component is initialized if (CurName='') or (NewName='') or ((AComponent<>nil) and (csDestroying in AComponent.ComponentState)) then diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index f9d7044c59..bd1d1e826d 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -1271,6 +1271,8 @@ resourcestring lisThereWasAnErrorWhileCopyingTheComponentStreamToCli = 'There was an error ' +'while copying the component stream to clipboard:%s%s'; lisErrorIn = 'Error in %s'; + lisDesThereIsAlreadyAnotherComponentWithTheName = 'There is already another ' + +'component with the name %s%s%s.'; lisTheComponentEditorOfClassInvokedWithVerbHasCreated = 'The component ' +'editor of class %s%s%s%sinvoked with verb #%s %s%s%s%shas created the ' +'error:%s%s%s%s';