Ian Branch 127 Posted April 16, 2023 (edited) 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 April 16, 2023 by Ian Branch Share this post Link to post
dummzeuch 1505 Posted April 16, 2023 (edited) 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 April 16, 2023 by dummzeuch Share this post Link to post
Uwe Raabe 2058 Posted April 16, 2023 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
Ian Branch 127 Posted April 16, 2023 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
programmerdelphi2k 237 Posted April 16, 2023 in Form Text format, the button has all properties ok? Share this post Link to post
Ian Branch 127 Posted April 16, 2023 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
Uwe Raabe 2058 Posted April 16, 2023 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
Ian Branch 127 Posted April 16, 2023 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
programmerdelphi2k 237 Posted April 16, 2023 is it possible up your forms (if inherited or not)? Share this post Link to post
Ian Branch 127 Posted April 16, 2023 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
programmerdelphi2k 237 Posted April 16, 2023 (edited) @Ian Branch well, if you can reproduce it, then I see that can be your IDE no? Edited April 16, 2023 by programmerdelphi2k Share this post Link to post
programmerdelphi2k 237 Posted April 16, 2023 some plugin installed or suite problematic? Share this post Link to post
Ian Branch 127 Posted April 16, 2023 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
dummzeuch 1505 Posted April 16, 2023 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
SwiftExpat 65 Posted April 16, 2023 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
programmerdelphi2k 237 Posted April 16, 2023 (edited) @Ian Branch let's try this: a new IDE session using another name all will be fresh... no 3rd-cmps, no plugins close all 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 April 16, 2023 by programmerdelphi2k Share this post Link to post
Ian Branch 127 Posted April 17, 2023 (edited) 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 April 17, 2023 by Ian Branch 1 Share this post Link to post