Error registering component in TMS IDE.
I have huge application which, registers most of the classes on start. And when I try to register components within TMS IDE Engine, I keep getting errors, and none of the components are registered.
Example of Error message:
---------------------------
Debugger Exception Notification
---------------------------
Project Ololo40.exe raised exception class EFilerError with message 'A class named TDBGrid already exists'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
Call stack:
TRegGroup.RegisterClass(TDBGrid)
TRegGroups.RegisterClass(TDBGrid)
RegisterClass(TDBGrid)
TIDERegisteredComp.SetCompClass(TDBGrid)
TIDEEngine.RegisterComponent('Data Controls',TDBGrid,'Grids,DBGrids')
IDERegisterDataControlsTab($3D8EC80)
The problem is in unit IDEMain.pas in procedure SetCompClass of TIDERegisteredComp
procedure TIDERegisteredComp.SetCompClass(const Value: TComponentClass);
begin
FCompClass := Value;
RegisterClass(FCompClass);
end;
I suggest you to add check if class hasn't been already registered before call RegisterClass. Here's fixed code:
procedure TIDERegisteredComp.SetCompClass(const Value: TComponentClass);
begin
FCompClass := Value;
if GetClass(Value.ClassName)=nil then
RegisterClass(FCompClass);
end;