Prince Jea
Prince Jea

Reputation: 5680

Error Loading a Form

I am a .Net programmer and I'm currently debugging a Delphi application and as I go along I encountered the following error:

Error_Message

Could you explain to me what is this error, and how I can resolve it?

I am new to using Delphi.

Upvotes: 3

Views: 1742

Answers (2)

user1175743
user1175743

Reputation:

Error Explanation

The error that is been presented to you is telling you that a component on that form is not registered in the IDE, in this case TsStatusBar which is from the AlphaControls library: http://www.alphaskins.com/

The form would have been saved at some point with TsStatusBar placed on the form. When any component is added onto a form they leave references to the component in both the forms source file (*.pas) and the inside the forms dfm. This is why you are getting this error, because the component cannot be found, yet the references linking to it still remain.

Option 1 - Install the AlphaControls packge

The best option would be to install the components that are missing, this will solve your error problem as shown in your question.

Option 2 - Convert Project

AlphaControls provides a tool to convert a project from standard VCL to AlphaControls and vice versa, this may be an easier option then installing the AlphaControls package or manually editing source files, the convert tool is free. Just remember to make a backup before converting should anything go wrong.

Option 3 - Manually Editing the Source Files

You could manually remove these references yourself. Do note though, if you remove the references then Delphi will no longer know that the TsStatusBar was ever there, and without a doubt there will be code somewhere that would have interacted with this component which will create compiler errors.

As an alternative to removing the references, you could rename them from TsStatusBar to TStatusBar, which is a standard statusbar from the VCL. At worst there may be some small syntax errors that may need correcting. If you do decide to edit the forms source and dfm files then I would suggest you do it before loading the form into the IDE.

Option 4 - GExperts

You can also install an IDE Expert such as GExperts which can automate the process of renaming/converting component references.

I would however advise against removing or renaming the references in this circumstance as it seems the project is reliant on the AlphaControls package.

Summary

I can see there are more components from the AlphaControls package been used, so fixing the TsStatusBar error manually will only fix part of the problem.

If the project must remain in its current state then Installing the AlphaControls package is the way to go, if you are able to edit it then I would also suggest the project convert option, this way you won't even need the AlphaControls package.

If you do chose to install the package, it is important to realise that once you install the package Delphi knows where the source files are to be able to compile. After installing the packages, goto Menu > Tools > Options from the IDE, then you need to go to Library and add the folder for the AlphaControls source to the library path. The source folder will be the one containing the most .pas files, but you could add all folders if you are unsure. If you don't add to the Library path then Delphi will not be able compile when using the new components.

Upvotes: 13

David Heffernan
David Heffernan

Reputation: 613441

Your IDE does not have the package which contains TsStatusBar installed. Find that package, build it, and install it.

Design time components need their code to be integrated into the IDE. This is done using what are called packages. The package project has extension .dpk. You should find this package project in your revision control system. Load the .dpk file in Delphi, click Build from the package manager, and finally, when built, click Install. Now that the package with your component is known to the IDE, your form will load. Whoever maintains this code in your organisation will be able to help with all the details.

Upvotes: 2

Related Questions