* * *

Author Topic: "Unable to find the component class" error when switching to Form view  (Read 1016 times)

soenke

  • Newbie
  • Posts: 2
I'm currently trying to port FreeShip+ to non-Windows-OS using Lazarus.
Whileas I managed to get it to compile with FreePascal 2.6.0/Lazarus 1.0RC1 (still no luck running it, but this is work-in-progress), I've run into some problems with the IDE.
I'm new to FPC, so please be kind... ;)

When trying to switch from Unit view to Form view (F12), I have some units where it is not possible to get a preview of the form layout.
The IDE throws the following error:

Quote
Unable to find the component class "TFreeShip".
It is not registered via RegisterClass and no lfm was found.
It is needed by unit:
/home/soenke/FS_src/Forms/Main.pas

[Ignore, us TForm as ancestor]   [Abort whole loading]   [Cancel loading this component]

Class is declared as follows
Code: [Select]
      TFreeShip             = class(TComponent)
                                 private     { Private declarations }
// ... 

Implementation section also contains
Code: [Select]
procedure Register;
begin
    RegisterComponents('FreeShip', [TFreeShip]);
// Also tried without luck:
//    RegisterNoIcon([TFreeShip]);
//    RegisterClass(TFreeShip);
end;{Register} 

Maybe I have overseen something, but at the moment I'm absolutely clueless.

Thank you very much in advance for your replies,
Sönke

Leledumbo

  • Hero Member
  • *****
  • Posts: 4305
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: "Unable to find the component class" error when switching to Form view
« Reply #1 on: August 06, 2012, 07:59:39 pm »
You have to create a package containing the component and register it to the IDE, otherwise the IDE would have no idea how to stream the component.

soenke

  • Newbie
  • Posts: 2
Re: "Unable to find the component class" error when switching to Form view
« Reply #2 on: August 06, 2012, 09:19:59 pm »
OK, just wonder about the sense of the "[Ignore, use TForm as ancestor]" option.

Thanks for your reply.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads