0

I have many components registered in Delphi 7 that I use in my main project.

When opening a new project, I can add those components, no problem.

When I open an old project using certain of those components, Delphi shows up : "Form1.Mycomponent does not have a corresponding component. Remove the declaration?"

and in the component palette, "Mycomponent" is no longer displayed. Why?

user382591
  • 1,320
  • 5
  • 19
  • 39
  • My components do not belong to a package – user382591 Nov 14 '13 at 10:55
  • 2
    It must have been. Otherwise it wouldn't be shown in the components palette. – TLama Nov 14 '13 at 10:56
  • 2
    Put them in a package then. That's the way to install components. – David Heffernan Nov 14 '13 at 10:56
  • Uh-oh! @DavidHeffernan, that is only half of the answer. Since it came so far as to "Remove the declaration?" it means he alrady had raced behind initial ["Class xxxx not found" error](http://stackoverflow.com/questions/19923926/) and destroyed his form's DFM by choosing to ignore it and removing the components from it and then saving the corrupt DFM. Well, hopefully he can recover old form sources from history or from DVCS – Arioch 'The Nov 14 '13 at 10:59
  • @user382591 there is a special package that you install those components that do not have a dedicated DPK. http://stackoverflow.com/questions/8685060/ – Arioch 'The Nov 14 '13 at 11:01
  • @Arioch, according to *"I can add those components"* seems that OP have them already installed, so broken DFM seems to be the answer... – TLama Nov 14 '13 at 11:02
  • I ckecked "User Borland package" in the package list and now the components are displayed in the components palette but I still get "Form1.Mycomponent does not have a corresponding component. Remove the declaration?" – user382591 Nov 14 '13 at 11:03
  • @TLama in a new project. So unless he uses mrExperts or like that, the new projects go into "all-included" mode. But in his current project he disabled the needed package (probably dclusr), then he blisfulyl ignored the "not found error", then he saved the damaged DFM, and then he realised he no more has those classes neither in Pallette nor on Form. That is the most probable sequence. So he has to undo his changes either manually or from history. – Arioch 'The Nov 14 '13 at 11:05
  • Of course you still get that error. You already damaged your DFM. When did you last time saw "Class TMyComponent not found" error ? if it was "5 minutes ago" you may try to close your project WITHOUT SAVING ANY UNITS/FORMS and then re-opening it. Anyway, see my 1st comment, you have to undo DFM changes bac kto the non-damaged version – Arioch 'The Nov 14 '13 at 11:06
  • Yes, probably. dcluser package corresponds to "User Borland package" and was unchecked. – user382591 Nov 14 '13 at 11:06
  • If you don't use a VCS, you may have a chance that the previous version of the DFM file will be saved as `UnitName.~dfm`. If you'll be lucky, you will find the right version to your PAS file. You can just take that file and overwrite your current DFM file. Just be sure you don't save the current changes and make a backup of the current state before you do so. – TLama Nov 14 '13 at 11:14
  • 1
    Thanks guys. I have backups and could get an old .dfm file working. I don't understand why "User Borland package" was unchecked. But now, issue is solved thanks to your help ! – user382591 Nov 14 '13 at 11:15
  • @TLama you seems started to make an answer ? – Arioch 'The Nov 14 '13 at 11:34
  • @Arioch, feel free to post one. I need to get back to work ;-) – TLama Nov 14 '13 at 11:36

1 Answers1

0

I had a similar problem with the components palette, since their elements were missing.

After searching very much for help, I discovered (in my case: Delphi 7 under Windows 8.1) that it was a problem with the installation process.

During installation, I very often used to choose the TYPICAL option, and it was the cause of the problem. Since I chose CUSTOM and answered every question with a NEXT, the problem was solved.

Slyvain
  • 1,732
  • 3
  • 23
  • 27