Recent

Author Topic: Unable to find the component TDataSource with Lazarus 2.2  (Read 604 times)

tintinux

  • Sr. Member
  • ****
  • Posts: 322
    • Gestinux
Unable to find the component TDataSource with Lazarus 2.2
« on: August 11, 2022, 02:57:52 pm »
Hi

When loading a .lfm, I get this message :

Unable to find the component class "TDatasource".
It is not registered via RegisterClass and no lfm was found.
It is needed by unit:  (the unit I load)


This occurs with Lazarus 2.2, not with 2.0.x I used previously.
Other .lfm in my project contain a visual TDataSource and load without problem.

What should I check or change ?
Thanks

Initiator of gestinux, open-source, multi-database and multilingual accounting and billing software made with LAZARUS.

You can help to develop, to make and improve translations, and to provide examples of legal charts and reports from more countries.

HeavyUser

  • Sr. Member
  • ****
  • Posts: 397
Re: Unable to find the component TDataSource with Lazarus 2.2
« Reply #1 on: August 11, 2022, 04:52:11 pm »
1) open the components dialogue/palette and see if the tdatasource is listed in there to rule out something wrong with your installation.
2) compress and attach the problematic unit and its lfm so we can take a look.

I'm assuming some short of problem with the type name where the letters might look the same but are comprised from the English letters expected, it can happen after a manual editing of the lfm or the pas file.

You can try to manually delete the component from the lfm and unit and re-add it anew.

tintinux

  • Sr. Member
  • ****
  • Posts: 322
    • Gestinux
Re: Unable to find the component TDataSource with Lazarus 2.2
« Reply #2 on: August 11, 2022, 07:30:29 pm »
Hi

The TDataSource is present in the palette and looks correctly installed. Other similar units having a TDataSource in the .lfm load without problem.

The .pas and .lfm are attached. The .lfm was renamed to .lfm.txt since this forum doesn't allow .lfm uploads  %)

The full project is Gestinux/trunk and can be found on SourceForge.
Initiator of gestinux, open-source, multi-database and multilingual accounting and billing software made with LAZARUS.

You can help to develop, to make and improve translations, and to provide examples of legal charts and reports from more countries.

Nicole

  • Sr. Member
  • ****
  • Posts: 356
Re: Unable to find the component TDataSource with Lazarus 2.2
« Reply #3 on: August 11, 2022, 08:15:31 pm »
in doubt, do this:

Right click to the white area of your components, choose "show all". There you can key in anything which tries to hide away. Like "datasource".

HeavyUser

  • Sr. Member
  • ****
  • Posts: 397
Re: Unable to find the component TDataSource with Lazarus 2.2
« Reply #4 on: August 11, 2022, 08:40:49 pm »
Sorry, I do not see anything wrong with your files. It should work.
The only thing I can think off to do, is to open the lfm in a text editor and delete the datasource from it (all 4 lines), also delete it from the pas file and see if that opens the form correctly.
If it does, then add it again.

tintinux

  • Sr. Member
  • ****
  • Posts: 322
    • Gestinux
Re: Unable to find the component TDataSource with Lazarus 2.2
« Reply #5 on: August 12, 2022, 08:17:28 am »
in doubt, do this:

Right click to the white area of your components, choose "show all". There you can key in anything which tries to hide away. Like "datasource".
Sorry, I don't understand what you want me to do. Remember that I can't load the form and see any visual component.
Initiator of gestinux, open-source, multi-database and multilingual accounting and billing software made with LAZARUS.

You can help to develop, to make and improve translations, and to provide examples of legal charts and reports from more countries.

tintinux

  • Sr. Member
  • ****
  • Posts: 322
    • Gestinux
Re: Unable to find the component TDataSource with Lazarus 2.2
« Reply #6 on: August 12, 2022, 08:23:51 am »
Sorry, I do not see anything wrong with your files. It should work.
The only thing I can think off to do, is to open the lfm in a text editor and delete the datasource from it (all 4 lines), also delete it from the pas file and see if that opens the form correctly.
If it does, then add it again.

Ok, it is what I did, and it works.

However, this is very weird. I reduced the difference between bad and good file to the indice following the Datasource component in the .lfm.
The indice order are exchanged and everything else is the same.
The "bad" file doesn't load, the "ok" does, it is reproductible.






Initiator of gestinux, open-source, multi-database and multilingual accounting and billing software made with LAZARUS.

You can help to develop, to make and improve translations, and to provide examples of legal charts and reports from more countries.

Nicole

  • Sr. Member
  • ****
  • Posts: 356
Re: Unable to find the component TDataSource with Lazarus 2.2
« Reply #7 on: August 23, 2022, 12:49:17 pm »
Workaround:
This happens to me now and then with various components (version 2.22)

I do this: I add the type of component again. This makes the uses clauses (or something else as well?) rewritten, and the error message is gone. Usually. The mess has to be deleted because nobody likes strange components which are only dummies. After deletion of them, the error comes back in rare cases. Mostly it is gone.


Nicola Gorlandi

  • Full Member
  • ***
  • Posts: 113
Re: Unable to find the component TDataSource with Lazarus 2.2
« Reply #8 on: August 27, 2022, 08:02:07 am »
Hi had the same issue and it was because in the lfm the class of object was wirtten with different case.

Example from
object DBcodice: TK6DBEdit[2]
to
object DBcodice: Tk6dbedit[2]

The right version has to be taken from the RegisterComponents('NicoSoft', [Tk6dbedit]).

Hope it helps

Thaddy

  • Hero Member
  • *****
  • Posts: 11943
Re: Unable to find the component TDataSource with Lazarus 2.2
« Reply #9 on: August 27, 2022, 10:32:43 am »
If the TDatasource is in another unit, include that unit in the uses clause?
Black themes should be banned.

 

TinyPortal © 2005-2018