Posts: 185
Threads: 55
Joined: Jul 2019
Reputation:
2
Location: Luxembourg
12-16-2019, 07:17 AM
(This post was last modified: 12-16-2019, 07:19 AM by SorenJensen.)
Hi All,
I have a strange problem in my project. I don't know if it is related to IW, but you guys are the best to ask, I recon:
I have a project (usual HTTP SA) with 15+ forms and during all the time I've been developing it, I have never been able to see the forms in the project Options (Project, Options, Applications, Forms), but I can now. I can actually move them between available forms and auto-create forms.
It started after I renamed a form and saved the pas file as another name. After I removed the original file from the directory, IDE reported error F2613, unit (original name) not found. After some searching it turned out to be in a uses clause (after implementation) in one form, where the original unit name was. When correcting the error, the project compiled ok.
But since then, I now have the list of forms in my project, shown in project options.
Is it no longer regarded by IDE as an IW project ?
Regards
Soren
Posts: 1,136
Threads: 37
Joined: Mar 2018
Reputation:
30
Location: Limassol, Cyprus
The IDE has several ways to "recognize" a project. It would seem that somehow that part of the IDE now sees it as a VCL/FMX app. I would not use those options, it might try to rewrite your DPR and if so the results would not be compatible with IW.
Posts: 185
Threads: 55
Joined: Jul 2019
Reputation:
2
Location: Luxembourg
Hi Kudzu,
I'm not using the option, just wonders why it's suddenly possible.
I have of course checked other projects but it's only that one where it is possible, and for a while I had a feeling that whatever I changed on the form (the one I had changed the name), nothing changed in the exe-file. However it's a form with a TMSAdvWebGrid and there are so many different property settings I'm not sure really how's working, so I'm not quite sure if it was because I was not changing the right ones.
The problem with the form name in the uses clause and error F2613, show that apparently is possible to include a pas file in the application, without adding it to the project. It might always have been possible, I don't quite remember, but I'm thinking if that is a possible reason. I recently added some older units from the VCL days to the project, that is, units with standard procedures and functions (only Classes and Sysutils in their Uses Clauses) and wonder if that is one of the reasons. A few of them was not added to the project, but still used in the code. Though, after I have added them, the list of forms in Project options is still there.
I have another project using the same units (all added to the project), and there are not problems and no list of forms in project options.
I'll try to create a new project, and add all files to the new project. Including UserSession and ServerController, and see if the problem disappears.
Regards
Soren
Posts: 2,250
Threads: 193
Joined: Mar 2018
Reputation:
86
Location: Auckland, New Zealand
It has always been possible to reference units in your project without explicitly including them in it, as long as the compiler is able to find them (via Project options paths or global library path). However, this is not the "correct" way of doing it. Except from library units (3rd party and even your own), which are included in global library path for all projects, your units belonging to the project - especially forms - should be included explicitly in the .DPR file.
Delphi IDE builds the list of units of the project from the units referenced in the DPR file. Likewise, the list of forms come from there (the IDE retrieves the form names from the comment added after the unit name where the form is declared, in the DPR file). If the form is not listed in the project that's because the comment is not there. Example:
uses
Unit1 in 'Unit1.pas' {IWForm1: TIWAppForm},
In the case above the IDE will list IWForm1 as belonging to your project because it is explicitly listed in the DPR file.
I strongly recommend you to explicitly add all units to the project (using the recommended via IDE's menu option Project -> Add to Project). Once you do that, Delphi IDE and compiler will be able to list and build all units correctly.