In a package, I have a component which implements the ToolAPi IOTAIDENotifier Interface. The package can be setup, compiled and appears on the palette. A method of this component is designed to do something particular when a project, which uses it, is compiled (and not executed)...so far everything if OK.
The problem appears later, when I use this component on a TForm which belongs to another project.
When I try to build it, I get the compiler message File not found: ToolsAPI.dcu.
Here are the uses of the package:
Uses
{$IFDEF PACKAGESETUP} DesignIntf, DesignEditors,{$ENDIF}
Classes, ToolsAPI;
PACKAGESETUP is only defined when I compile the bpl
When I double click the error message, the IDE opens the file from which is declared the reference to ToolsAPI...How can I get rid of this problem ?
ToolsAPI is only available in designtime packages. It exists to expose the IDE for customisation and so is available only under the IDE, i.e. in designtime packages. You will have to remove the reference to ToolsAPI from your desktop app.
Related
I created a design-time package, placed it on disk C:, compiled, installed and added to Library path and Search path.
Now I create new project using a component from this package. Component is added to form, name of unit where the component resides is automatically added to uses, but then Delphi's editor complains that it cannot find the unit where my component is defined and also I am unable to compile.
I never had such a problem in Delphi 6.
What's wrong?
Design time packages cannot be used in your programs.
Usually, you have (or should have) a designtime package, which is only used for installation in the IDE, and a runtime package with the actual component code. The designtime package should have the runtime package in its requires section and register the components in the runtime package.
Your app should only use the runtime package. And that runtime package (or its units or .dcl file) should be in the Library or Search Path.
This separation of designtime and runtime was not enforced in Delphi 6 yet (IIRC), but in more current versions it is, by making some of the units in e.g. the designide package unavailable outside the IDE.
Update
If I remember correctly, the packages to be included in a designtime package for Delphi 6 are not the exact same packages a designtime package for the latest Delphis requires. Ensure that your requires section contains the correct packages for your version.
Ok, now I have untangled this puzzle.
There were multiple superposed Delphi issues:
If Delphi's IDE encounters an unhandled exception when loading DFM it doesn't go further and pretends that it didn't find the faulty unit and units that are listed after it. My problem was that the faulty unit was the last in uses clause, therefore only its name was underlined.
If Delphi's IDE encounters an exception in component's constructor, it makes an automatic "shutdown" for the faulty component by calling Free. Then it tries to use an already freed component and of course encounters Access Violation which affects the number 1.
Sometimes exception messages in component's constructor are suppressed, but IDE still makes a component's emergency "shutdown" which affects the number 2. To find out the exception messages an explicit try-except block is needed.
TChart cannot be created in component's constructor and raises an exception which affects the number 3. When TChart is created it requires a presence of an already created component's window, therefore it should be created in CreateWnd method.
I have to compile my project with a changed VCL unit. I use Delphi XE8. I copied Vcl.StdCtrls.pas from D:\Program Files (x86)\Embarcadero\Studio\16.0\source\vcl to my project folder where my .dpr file is localed, then I changed my copy of Vcl.StdCtrls.pas. I also added this unit to project tree. The problem is that with Delphi XE8 such method of recompiling VCL units no longer works. I put an obvious syntax error in my modified Vcl.StdCtrls.pas unit. Compiler does not report the error which means it does no even check the file. I always do a full build Shift+F9. I found a similar question How to recompile a specific unit from the VCL? but like I said, it no longer works, not for Delphi XE8.
Also, the modified unit is on my uses list in .dpr file:
uses
Vcl.StdCtrls in 'D:\Dev\MYPROJECT\Vcl.StdCtrls.pas',
...
// it does not help
This seems to be a bug. I guess you're using runtime packages. In XE7 such project will not compile - which is the correct behavior. In XE8 it compiles, apparently using the VCL runtime package and ignoring your modified unit.
Edit:
Note that even in previous Delphi versions, modifying a VCL unit while using runtime packages would still require you to repackage the modified packages and their dependencies (in this case, vcl and rtl).
In other words, you cannot simply use a modified unit while linking against a runtime package which contains another copy of that unit. Unit names must be unique within the full scope of the project, including the main executable and all linked runtime packages.
So the solution for you is to either:
not use runtime packages, or
repackage all required units into your own runtime packages, and link against them instead of Embarcadero-supplied rtl, vcl etc.
I am trying to migrate some code from Delphi 5 to Delphi XE7-WIN64. The scenario is DesignEditors is 32bit only since the IDE is 32 bit application. And the project I am migrating has units which have uses clause containing DesignEditors or DesignIntf or both.
Putting -LUDesignIDE in Build Configurations>Edit>Delphi Compiler>Compiling>Additional options to pass to compiler>-LUDesignIDE
Gives the following as first error on build
[dcc64 Fatal Error] E2202 Required package 'DesignIDE' not found
I am using Delphi XE7 trial version.
It sounds like you have a package which is both design-time and run-time combined into one. In most scenarios however, you must split your package into two different packages. One package is run-time (where you implement all of your actual library), and the other is design-time (which exposes your library to the IDE).
That being said, the design-time packages must work directly with the Delphi IDE. The Delphi IDE is 32bit, so the design-time package must also be 32bit. Whereas, your run-time package will support whatever platforms are needed. Your design-time package is only responsible for registering your components, property editors, etc. to the IDE.
Anything which has anything to do with the IDE (such as registering components, registering property editors, etc.) Must be in your design-time package which is only 32bit. Because of legal copyright issues, all design-time implementation must be in a design-time package, separate from your run-time package.
Start by creating a new design-time only package, same name but prefixed with DCL. Then, change your original package to run-time only. Create a new unit now in your new design-time only package. This unit will be dedicated to registering all IDE design-time interaction. Everything in your run-time package which relies on these design-time units must be converted over to this design-time package. These units which you cannot find are only compatible with the 32bit Delphi IDE.
The new design-time only package will then have to require your run-time package. You'll have to compile the run-time package first before you can compile the design-time package. Any time, you make changes to your library, you need to 1) re-compile the run-time package, 2) re-compile the design-time package, and 3) re-install the design-time package.
The ToolsAPI units can be included in Win32 designtime packages, and nowhere else. You are trying to include them in a Win64 executable project. That is not allowed.
The solution is that you remove all the ToolsAPI units from your project.
While opening a dfm file by double clicking, I am getting following error:
Class TMyClass not found. Ignore the error and continue? Note: Ignoring the error may cause components to be deleted or property values to be lost.
When I click Cancel, I get following message
Error creating form: Class TMyClass not found.
When I click OK now, pas file is opened only.
In pas file MyClass unit is added (which conatins the TMyClass defination) and its path is also added in my search path (Ctrl clicking on unit name, takes me to the unit file)
Everything is fine as per me. I don't know why I am getting this error and why am I not able to open this dfm file in RAD studio? Please help.
To create the component (that you placed on the form) Delphi IDE should know it by name and have its class loaded into memory. That means - it should have that component compiled into binary runtime package and that corresponding design-time package should be loaded into IDE and during the loading it should call RegisterComponent.
Usually this all is done during the library installation. So if you have that library for Delphi 7 now just install it for Delphi XE4 as well.
If your library does not have installer or that installer does not know XE4, then you have to register those components manually, just like Delphi documentations asks you to do.
That is a multi-step process, so you maybe would need to re-do it from starters. However with any luck you would probably be able to reuse the work already done for Delphi 7. At best case you only would have to recompile runtime and designtime packages in XE4 and then install those design-time ones into newer IDE.
http://www.cryer.co.uk/brian/delphi/error_class_not_found.htm
How to install a component from .pas file in delphi?
Delphi XE2: Encounter "Error Reading Form" when opening a project in IDE
Delphi XE4 "class not found" but compiles fine
http://docwiki.embarcadero.com/RADStudio/Rio/en/Installing_Component_Packages
http://delphi.about.com/library/howto/htinstallcomponent.htm
http://delphi.about.com/od/vclusing/ht/installwin32.htm
This problem occurred to me after a new version of Windows 10;
I adjusted by changing the permissions of my executable. I just removed the notification permissions and added it again;
https://support.microsoft.com/en-us/windows/change-notification-settings-in-windows-10-ddcbbcd4-0a02-f6e4-fe14-6766d850f294 for more details;
For me, this error happen when a visual control was declared as TSomething in the pas file and as TSomethingElse in the DFM file.
The solution was to manually edit the DFM file and put the control declaration to the correct value (TSomething).
The GUI for my company's main product was written in Delphi in the late '90's, and has been updated to Delphi 2007. I'm working with a group to update the Delphi 2007 to XE4.
We still use a number of components from ADL VCL (similar to DevExpress, but now defunct), but have not installed the entire package. Rather, we have the files we need located in a folder seperate from our project folder, and have the path to these files specified in:
Tools-Options-Library-browsing path
and
Project-Options-search path
When I open main, I get the error:
"TADLAboutBox not found. Ignore the error and continue?"
The unit "ADLAbout" that defines "ADLAboutBox" is declared in the uses clause in main.
Moreover, our project compiles just fine.
How can I get rid of these messages? What might be wrong?
Thanks very much for your advice.
The component is not installed in the IDE, so when you open a form that uses that component you get an error.
But the source to the component can be found so when you compile it will do that without problems.
To get rid of the error you must install the component in the IDE.
ADL VCL is not available for XE4, since it was discontinued some time before XE4 was released. If you have the ADL source code, and have ported it to XE4, then it's plausible that you may have some success.
The error message you describe is symptomatic of not having the design-time packages for the components installed. You'll need to build and install design-time packages for any components that you want to interact with at design-time.