I successfully built the Advantage Delphi Components package into Lazarus 1.0RC1. After the rebuild/restart of Lazarus, everything seemed to work fine... until the next time I restarted Lazarus. Now, when Lazarus opens my project on startup, I received the following error message:

  Unable to find the component class "TAdsStringfield".
  It is not registered via RegisterClass and no lfm was found.

Additionally, the DataSource property drop-down of my DBGrid and DBMemo components shows no available DataSource choices. I have added the adsdata unit to the Uses clause, as has been required in the past. Note: This error only happens when the project contains persistent fields (all fields in the table have been added via the Fields Editor).

asked 04 Aug '12, 11:02

Ule's gravatar image

Ule
31559
accept rate: 0%

edited 27 Aug '12, 15:00

Jed%20Thomet's gravatar image

Jed Thomet
2.7k12648


This error is a result of a bug in the 11.0.0.0 and 10.10.0.28 (and prior) versions of the Advantage Delphi Components. (Changes introduced by the Lazarus team between 0.9.30 and the 1.0RC1 versions of Lazarus exposed this issue.) This will be fixed in the next 10.10 and 11.0 EBF releases.

If you need an immediate fix, you can update the Register procedure in the adsdesign.pas source file and rebuild the Lazarus package. Here are the changes that you need to make. This block:


{$IFNDEF FPC}  // FPC doesn't support field type components
   RegisterFields( [TAdsStringField] );
   RegisterFields( [TAdsBCDField] );
{$ENDIF}

should be updated to read (note the addition of the "$else" clause):


{$IFNDEF FPC}  // FPC doesn't support field type components
   RegisterFields( [TAdsStringField] );
   RegisterFields( [TAdsBCDField] );
{$ELSE}
   RegisterClass( TAdsStringField );
   RegisterClass( TAdsBCDField );
{$ENDIF}

The problem is a result of the fact that the TAdsStringField class doesn't get registered with the Lazarus IDE without these calls.

You also asked why the "adsdata" unit is not automatically added to the "uses" clause when you drop an AdsTable (or other component) on the form... I've spent some time investigating this, and I believe that this is a bug in Lazarus. It appears that Lazarus is not properly adding all of the units that are required. (Where Delphi adds adsdata, adsfunc, and adstable for a TAdsTable component, Lazarus only adds adstable -- so it appears that it is only adding the unit that directly satisfies the component declaration, instead of also adding the units that are required by the unit it just added.) The addition of units to the uses clause for components is something that is automatically handled by the IDE -- and we don't expressly add any code to handle that.

Hopefully, this (amended) response is helpful.

link

answered 07 Aug '12, 09:50

Jed%20Thomet's gravatar image

Jed Thomet
2.7k12648
accept rate: 38%

edited 27 Aug '12, 14:48

I made the change but using the new Lazarus 1.0 general release I got this error trying to run the program: Class "TAdsStringField" not found Please let me know when the next EBF release can be downloaded and I'll try again. Maybe you could contact Lazarus' Mattias Gaertner about adding the units, etc. I could email you his forum email address.

(01 Sep '12, 12:11) Ule
1

I was able to try Lazarus 1.0. With the changes described (and adding the "adsdata" unit to the uses clause), the project builds and runs correctly. (Without the adsdata unit, I get the similar error "Identifier not found 'TAdsStringField'". As mentioned before, adding the unit resolves the issue (i.e. everything works properly).) I will see if I can contact Mattias or someone on the Lazarus forums to see if there's a way we can have the necessary unit added automatically.

(01 Sep '12, 12:51) Jed Thomet

Thanks, everything seems ok now. So that I don't have to explain the Register change, please let me know when the next version of adsdelphi is ready to download and I'll spread the word to other Laz users that ADS is now a credible alternative (and a big step up) to the now decremented (because it's no longer supported) Tdbf, the only other Laz component I know of that supports the dbf format.

(08 Sep '12, 13:02) Ule

Ule, If you're still watching this thread, I wanted to let you know that the 11.10.0.1 version of the Advantage Delphi Components has been released and is available for download. This contains all of the fixes that you and I have discussed. This version supports 1.0 and 1.0.4 Lazarus versions.

(06 Dec '12, 10:48) Jed Thomet

Perhaps my problems stems from having a Windows 7 >>64 bit<< computer, your instructions seem to be for a 32 bit system. Do you have a Win7 64 bit machine you could check adsl on?

I did uninstall both ads and old Lazarus before installing the new Lazarus.

I don't seem to have any lib/i386-win32 directory.

Under Project -> Project Options -> Compiler Options -> Inherited, a lot of path are shown. The first was incorrect for adsl but I don't know how to correct it.

Remember, it worked fine for me too until I exited and then re-entered Lazarus.

I hope we can resolve this. Tdbf, the only other database for Lazarus supporting the dbase format, has been deprecated and does not appear in either package list. Now that Lazarus is approaching the "prime time" version it may well start jumping in popularity.

Out of curiosity, why isn't adsdata automatically included in the uses clause like the other packages are when an Ads component is dropped on a form?

I will certainly appreciate any further help you can give me.

I hope this the right way to reply on this system!

link

answered 07 Aug '12, 12:44

Ule's gravatar image

Ule
31559
accept rate: 0%

I do have an x64 to test with... and, I get identical results to my response above. (I will edit the response to indicate the x64/x86 differences.)

On the "Inherited" paths, the one that matters (most) is the unit path for "adsl 10.10". (This name is incorrect, but it's the path that matters. I suspect that since this is wrong, there is a lingering file/setting from the old Lazarus instance. (Again, I'm updating the response above to be more clear on where/how to clean up some settings.)

Finally, the 1.0RC of Lazarus does not seem to need the adsdata added to the uses clause.

(07 Aug '12, 14:30) Jed Thomet

I did everything you said. The Inherited path is now correct, and the .lfm file itself doesn't get blown up, but basically the same problems:

  1. I still have to add adsdata to the uses clause for the sake of TADSstringfield
  2. When I do that and build the project, everything is fine and I can work happily away, everything is fine UNTIL I quit Lazarus and later start Lazarus again. Then I get that same error message again and can't do anything on the form, I can't even click on anything. Curiously I can still do a Run|Build and it's successful and the .exe it creates runs fine, but I can't change anything.

Is it possible you're using a different version of adsl.lpk than I'm downloading from the ADS website?

I hope we can get this resolved somehow. I did make a zip archive of my test project that I can send you as an attachment if you give me your email address, or I could upload it to something like Rapidshare that you could download for free.

link

answered 08 Aug '12, 16:53

Ule's gravatar image

Ule
31559
accept rate: 0%

I think I may see the problem now; but the errors I'm getting are a bit different. Can you send your zipped test project to advantage@sybase.com attn: Jed? Also, just to see if it's a factor, can you try creating a new project in the 1.0RC version of Lazarus (just to see if the behavior is the same)? I'm concerned that the internal representation of the project may have changed between a prior version and this version.

(09 Aug '12, 08:49) Jed Thomet

Hello Jed, I was glad to see you say "I think I may see the problem now" and I sent you the test project zip file last Thursday. Any updates? Thanks.

link

answered 16 Aug '12, 15:35

Ule's gravatar image

Ule
31559
accept rate: 0%

I've had a chance to look at this. Please see my updated answer above. (If that doesn't work, please reply to that answer with another comment, instead of adding a new "answer" to the question.)

(16 Aug '12, 15:52) Jed Thomet
Your answer to the original question.
If responding to a request for additional information, please edit the question or use the comment functionality.
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×8

Asked: 04 Aug '12, 11:02

Seen: 5,394 times

Last updated: 06 Dec '12, 10:48

Advantage Developer Zone Contact Us Privacy Policy Copyright Info


Powered by Advantage Database Server and OSQA
Disclaimer: Opinions expressed here are those of the poster and do not necessarily reflect the views of the company.