Delphi .exe after build error - delphi

good day! i have a project and it runs perfectly, i did that project 3 months ago. Then, i tried to put some changes and even BUILD ONLY the project (no additional codes). When i open the .EXE it appears errors like this.
when i clicked DON'T SEND
and when i clicked OK
When i opened the form this message appers:
How to fixed it? I really need to add some functions to that project.
Thanks in advance!

Your .dfm file refers to a property that is not published by the component which is being streamed. The streaming framework is attempting to read into a property named Quality of an object named frxPDFExport1. And that object does not publish a property of that name.
Most likely there's a mismatch between the design time package that you used to generate the .dfm file, and the run time component that is reading that .dfm file. Have you upgraded one and not the other recently?
I'm afraid I cannot give you precise steps to fix the problem, but what I describe above is what is happening. Hopefully that will be enough to lead you to the solution.

You must have updated the component used, which looks like Fast Reports. You need to open up the form in Delphi and the new property will be added by Delphi. Any other forms that use the same component will also need to be opened up to update the properties.
When the error reading form message comes up, click ignore. This should add the missing property. You will want to view the DFM as text to make sure the property has been added.

Related

Delphi, class not found [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
After a voted closing of this Thread/Question, i had my Problem fixed.
But i still want to give it a shot to re-write my Problem/Question, so others could benefit from it. So here i go:
Main Problem:
I´ve got a Project using two external Dependencies. Those Dependencies represent Elements which are Visually shown in the Form-Editor.
The Exact Problem is, that the "Main" Project can´t seem to find these Dependencies, therefore the Visual Representation of the Form can´t get generated.
This Error gets Displayed with the Message "Class can´t be found.", and therefore i can choose to either ignore the Error - which results in deleting all occurences of the missing class in the opened form - or i can cancel the opening of the Form-Editor.
I also read somewhere - correct me if i´m wrong - that these Dependencies in my case are called Units in Delphi.
I got the Sourcecode to these Dependencies, which in my case are a *.dcu, a *.pas and a *.dpk file.
So the Question would be:
How does one add external Units to a Delphi Project?
The Path to the Solution:
The first hint to solve my problem was given by #fpiette:
But a developer can write his own component. To be usable by Delphi IDE, this component needs to be "installed". That is build in a package (A special kind of project in a .dpk file)
So now i needed to search for a *.dpk file, which i "conveniently" have for each dependency.
After a little bit of further investigation, i found this - or more specifically:
The directory where you store the .dcp file—and the .dcu files, if they are included with the distribution—must be in the Delphi Library Path.
Now i knew, i also need to add the Path of these Sources to my Library.
The last step missing was now only to "add" these Files to my Project. After playing a bit around with the IDE, i found the Prompt "Install Component", under the "Components" Tab.
In the upcoming Wizard i selected to install the Unit into a new package, and selected the *.pas File for the Dependency. The next Windows asked for a "Name" in form of a *.dpk File, which i also have in the sourcefolder.
So after selecting the *.dpk File, my Project was converted into a Projectgroup, and had the newly added Dependency as a second Project besides my "Main" Project.
So i did these Steps with all Dependencies needed, compiled all Dependencies and now the IDE wouldn´t show the Error anymore but open the Form-Editor correctly.
I also want to mention why it didn´t work for me earlier - or at least what i think what my Error was:
In the Described "Install Component"-Wizard, i selected the *.dcu file instead of the *.pas File. The Dependency was still added to my ProjectGroup, but didn´t solve my main Problem.
So i "reverted" back to my starting-point, and selected the *.pas file instead of the *.dcu file.
I hope my Problem is now better explained and formatted, im open for criticism!
Thanks for your help earlier, and have a nice day!
What you named "Picture" and designated as .dfm file is actually named a "form".
When you open a form, the IDE make a visual representation of it and for that need all components referenced in it. There are hundreds of components delivered with Delphi (Well know such a button, edit, combobox and much much more).
But a developer can write his own component. To be usable by Delphi IDE, this component needs to be "installed". That is build in a package (A special kind of project in a .dpk file). That package must be compiled and the installed (right click in project manager).
If a component used by a form is not installed, you get the error you said. Do NOT click "ignore" in the messagebox but click "Cancel". Then close the form, install the component and reopen the form. If you click "ignore", then IDE will REMOVE that component and your application will be broken (Do NOT save it then).
You have been given the source code, so search for a .dpk file (or several). Then open it, compile it and install it. Only then you can open the form giving the error.
By the way, you should really buy a good book about Delphi. There are a lot of Delphi books. I suggest you start with Object Pascal Handbook

How to store a large text in a Delphi component?

I made a custom component that needs a rather large (say 1MB) UTF8 text to function. For development purposes, I just loaded this from a file. Now I want to get rid of that file. What is the easiest way to store its contents in the component, such that the user of the component needn't bother with this?
First I tried making it string constant, but soon Delphi started to complain in many different ways (too long or too many, out of memory, etc.). When I switched to embedding it as a resource, I found that the resource will not be automatically compiled into the actual application as well, so it's not transparent to the component user...
Update
I got it working if I create a resource file myself, which I manually add to the unit. Then, I still need a pre-build event for it to be actual. The question remains why it doesn't work if I add it to the package, via the Delphi menu, rather than to the unit. And why {$R myresource.res myresource.rc} doesn't compile it automatically as it should...?
Update 2
Apparently the resource script needs to be added to the project for automatic compilation to work.
Adding the {$R myresource.res} line in the unit containing the component should work.
You can add the myresource.rc file to the component's package to make Delphi generate myresource.res automatically.

Very Weird Behavior: Delphi 5 adding a component on my form with empty name

Now this is a very puzzling matter I hope you can help me.
I have a custom component derived from TCustomControl that is included in a package. This package is correctly compiled and installed in D5. The package also requires the use of another library of components the ImageEn library.
I have an application that uses this component, Now until some day ago everything seemed to be fine, but now, after some recent changes to the component (mostly changing the name of the types it uses) I am having a very weird behavior going on. On the form where this component is placed Delphi will create I would say just for no reason a TImageEnIo component (from the ImageEn library) that was not even included in the dfm of the form.
Even more puzzling is the fact that this added imageenio component has no name, thus causing me a lot of trouble when I try to run the application (run-time error). If I delete this component it will reappear as soon as something is updated (for example if I switch between the text and the form of the dfm). Delphi just adds this thing on any form , where I use my custom component. This happens only when my custom component is present, other comps of the package do not generate this problem.
I noticed that it creates 1 of these empty TImageenio for each custom component I have on the form, and moreover if I switch back and forth between the text and the form views of the dfmit will add another imageenio component each time I do this.
Finally the problem is not dependent from the application as it will happen with any application as long as I add my custom component on a form.
Now I have been recompiling everything the imageen and my package many times, I have even tried to restore an older version of the component but the problem persisted (I am quite sure I hadn't experience it with the older version), I have tried anything conceivable but I cannot figure it out. I am at a complete loss, please advice If you need more info please ask, I will try to explain better.
Many Thanks to those who will take the time to answer.
It would seem that the problem was introduced by recent changes in your custom component.
You should use your revision control system to go back to a known good version. Then advance to intermediate versions of the code, perhaps using a binary search for efficiency. Once you've isolated the revision which introduced the bug then you should be able to study the code changes in that revision and identify the problem.
Wild guess: Your custom component directly or indirectly instantiates a TImageEnIo with the wrong Owner. Instead of using Self (i.e. the custom component instance) it uses its Owner property, which points to the form it is sitting on.
The first thing I would try would be to start a new application, create one of your custom controls at run time and put breakpoints on the third party source code where the TImageEnIo component is instantiated, constructor of the component would be fine. If the design time behavior is exhibited at also run-time, the breakpoint would be hit and you would be able to figure out the code part creating the component from the stack trace.
Otherwise, it is possible to debug design-time behavior by debugging the IDE with another instance of the IDE, but I don't know how it can be done with D5.

Cannot open .dfm files in IDE

My system configurations are a follows Delphi2010 on windows 7 professional. I have a problem with some of .dfm files in the project.
I got it as follows. First of all I needed to change some datatypes of TOraQuery component fields from TStringField to TWideStringField and I started it doing manually like opening .dfm change one by one (Find-Replace) everything was fine later on because our project is huge I decided to change everything at once so by using Notepad++ editor and by using option Find in Files and replace all I did replacement. So after this operation I started getting this error like 'TWideStringF class not found' when I wanted to open particular .dfm file. I cannot open this .dfm files even if I press ignore.
PS: Even when I try to open files that has errors in Notepad++ editor to get the line TWideStringF I cannot find it.
How to solve this problem ?
Can anyone give me a clue ?
thank you.
Try finding the "TWideStringF" in ALL your source code first to know where the problem is comming, after that, well, all dependes on what you find!
The Delphi IDE need to be able to find the classes specified in the DFM. It creates instance of these on the design surface for you to interact with.
Editing a DFM by hand is a common practice. I do it often, as sometimes it is faster than any other method. However, it comes with a problem if the class or property can not be found it can cause the DFM not to load. So extra care must be taken to insure that manual edits done correctly.
In this case you can restore the file, and redo the search and replace, or to look at the instances where it's broken and fix them all by hand.
Search for: TWideStringF I suspect you will find that is missing the remaining ield required. Note: Searching in IDE will not work as it won't search DFM files.

Delphi - Class TListView not found

We have a Delphi 5 application, that is built without runtime packages, dlls or external resources (i.e. a single executable). when we install it on a clients PC we get the following error messages:
Class TListView not found
or
Class TImage not found
We have installed it on dozens of PCs before without incident, but this latest install is problematic.
The target PC is a fresh install of Windows XP (Service pack 3) with no other software installed.
It does not complain about all of the classes however just one or two. for example TPanel/ TForm/ TEdit are all OK.
Can anyone think what is causing this?
EDIT
The exe on the new PC is on 30 or so other PCs that I know of, ranging from windows XP Sp1,2,3, Windows Vista and Windows embedded. both old and new PCs were installed with an old version and then updated with the newest version. The only difference is that the version jump was higher for the latest install.
This is typically an error during the streaming of a .DFM. Usually this error occurs with TLabel components because many folks remove the TLabel fields from the form or frame in order to cut down on the clutter and reduce the instance size of the form. The common and confusing mistake they make, however, is that in their over-zealousness, they remove all TLabel references. That is when bad things start to happen. Let me run down how the streaming system locates a component's class.
Remember that the class reference in the .DFM is just a string. The streaming system has to convert this string into a class reference (TComponentClass). There are two mechanisms that the streaming system uses to do this. The first one is very simple and involves a global list of class references. You can call RegisterClass or RegisterClasses to explicitly make the streaming system aware of it. The second is much more subtle and not very well known; in fact it is all part of the "magic" of Delphi :-). When the compiler builds the form, all the fields that represent the components on the form are processed and an internal table is built as part of the RTTI or metadata for the form/frame/datamodule itself. This table contains a list of references to all the individual component types represented by the component fields. So even if a component is not in the global list, it can still be found by scanning through this compiler generated table. That is what the Classes.TReader.GetFieldClass() method does.
Back to my TLabel example, this problem is easily fixed by simply ensuring that at least one of a given component type has a field. So as long as there is at least field of type TLabel, all the other TLabels will load just fine. So in your case, make sure the TListView or TImage fields haven't been deleted.
Re0sless,
I suggest you open and close every form of your application and do a fresh build after that. If memory serves me well, that was the solution when we encountered similar problems.
You might also take a look at DFM Check to open and close all your dfm's automatically and at CnPack to help you clean your uses clause.
Regards,
Lieven
I think Lieven is definitely on the right track: simple base classes not being found during runtime are a Delphi (linker) problem. This exception is not caused by the Operating System.
My experience with similar problems: the linker generates a project with the units wrongly arranged.
Example: a form unit is linked in before the base units. Forcing the project to completely recompile/relink itself should make this exception go away.
A simple [Rebuild All] will probably not suffice. You might try to recompile without optimizations.
I have tried to reproduce this error but I have not been able to. The Delphi compiler/linker is one of the best - speed of compilation/speed of compiled exes - but this bug is definitely a show stopper.
Note: I have only experienced
this error in D5. Has anybody else
experienced this error with other
Delphi versions?
I had the same problem. Class TCheckBox not found. I usually edit large set of components through .DFM of form(for example renaming large amount of component). This error comes when I rename all CheckBox on my form through it .DFM.
I just cut all the checkbox and paste them again(So .DFM file is refreshed). The error disappeared.
I've seen a similar problem due to a file copy error. To make matters more confusing, the fault was on an intermediate media device. The issue was resolved by simply recopying the file from the existing release build.
It is probably impossible to confirm now, but it is quite possible that the problem was 'solved'; not because of the removal of an unnecessay uses clause item, but because it also involved a new copy of the executable.
The solution for all errors of this type "Class XXX not found" is simple. Open DFM file of a form in text editor and manualy remove the definition of the XXX object in it.
Change the name of the Form and save the .pas with other name. Change all references to create the new unit name if this is used in other units. Build All.
With this the error disappeared.

Resources