Jump to content
Ian Branch

Class "abcdef" not found. error??

Recommended Posts

Hi Team,

D11.3.

I have a multi component App with several tabs on a form.

All works as designed/expected.

Recently I have tried to add a button or a label or something else o one of the tabs, it builds OK but when run I get a 'Class "abcdef" not found.' error  with "abcdef" being the added component.

It's not peculier to the tab either, it happens if I just want to add a component to the form.

Anybody seen this before?

Is it a known issue?

Have I reached some limit?

Is there a cure?

 

Regards & TIA,

Ian

Edited by Ian Branch

Share this post


Link to post

I remember getting errors like this when adding components to a form and then deleting their name in the object inspector. This worked fine if the form contained other components of the same type which had a name, but failed with that error if it was the only one.

 

That was with Delphi 5 though, so this might not apply to current Delphi versions.

 

Back then we used this trick to reduce the number of fields for labels in the class declaration, because these were fully initialised in the designer and never accessed in the code, so we did not need the field.

 

Edit: Thinking about it, it just occurred to me that the reason might be a missing entry in the uses list. Normally the IDE will add them for you, when you drop a component on a form. This may have failed for whatever reason.

Edited by dummzeuch

Share this post


Link to post
7 minutes ago, dummzeuch said:

Thinking about it, it just occurred to me that the reason might be a missing entry in the uses list. Normally the IDE will add them for you, when you drop a component on a form. This may have failed for whatever reason.

Usually all classes appearing in the interface section of the form are registered automatically. That doesn't cover components on the form without that corresponding field, whether the unit is added to the uses clause or not.

Share this post


Link to post

Hi Thomas,

Hmm.. food for thought.  It is only happening on one form out of 20 in the project.  It also happens to be the most complex form.

11 minutes ago, dummzeuch said:

I remember getting errors like this when adding components to a form and then deleting their name in the object inspector.

I presume you are referring to the Components name property?  i.e. it was blanked for some reason.

I would have thought that would have stopped it from compiling, let alone running..

 

It happens if, for example, I copy an existing button already on the form.  Builds OK but as soon as I try open that form with say a Button1.enabled := true;, I get the error.  :-(

Share this post


Link to post

As far as I can tell, yes.  But the button was just an example, it doesn't seem to matter what extra component I put on the form.

Share this post


Link to post

As what you describe usually works, there must be something you still missed to tell us. Hard for us to guess. 

Share this post


Link to post

Hi Uwe,

It's a case of 'I don't know what to tell you' that might help/clarify the issue. 🙂

Share this post


Link to post

No they aren't inherited.

I tried creating a brand new form, adding all the components and code as per the original and got the same issue in the new form.  😞  Strange.

Share this post


Link to post
Just now, programmerdelphi2k said:

some plugin installed or suite problematic?

I am suspecting the latter.  I removed all the plugins and the issue still occurred.

Share this post


Link to post

You said that error occurs when running the program. The first thing I'd do would be running it in the debugger, so I guess you did that too. Did it tell you where the problem is? Does it happen when reading the dfm from the resources?

Share this post


Link to post

One of the components is likely just missing an initialization section

initialization
registerclass(TComponent);

 

You could try to put it at the end of the Form and see if it will load. Just replace TComponent with the name that is failing to load.

Share this post


Link to post

@Ian Branch

let's try this:

  • a new IDE session using another name
  • all will be fresh... no 3rd-cmps, no plugins
  1. close all
  2. run your BDS.EXE -R << a new name here>>

a new key will be created in your EMB HCU registry keys... later, you can delete if desire

Edited by programmerdelphi2k

Share this post


Link to post

I FOUND IT!!!

For whatever reason I had the following order at the start of the unit..

type

  ....

   ....

private

....

....

const

....

....

public

....

....

end;

 

Something in me said this didn't look/feel right so I changed it to 

type

....

....

private

....

...

public

....

....

end;

 

const

....

....

 

and all is fine now.

Exactly why I had the const in the private section, I can only specualte that I was trying to make the consts private......

 

FWIW, this is the const declaration..

const
  sNoSvcEmail       : string = 'There is no Service Email Address recorded in the Company data!';
  sNoCorpEmail      : string = 'There is no Corporate Email Address recorded in the Company data!';
  sPrintMsg         : string = 'The Job Ticket not in the correct status for this print function!';
  // The following are for IndexOrd.
  aIndexOrd         : array of string = ['Job #', 'Customer Ref.', 'Job Status', 'Account Code', 'Job Type', 'MSN', 'ESN', 'User ID', 'Account #', 'Customer #',
    'Service #'];
  aSortOrder        : array of string = ['JobNo', 'CustomerRef', 'JobStatus', 'AccountCode', 'JobType', 'MSN', 'ESN', 'UserID', 'AccountNo', 'CustomerNo',
    'ServiceNo'];

 

Anyway, all good now, I can add components again to my hearts content.

 

Thank you all for your interest and suggestions/contributions.  Very much appreciated.

 

Regards,

Ian

Edited by Ian Branch
  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×