Sonjli 6 Posted May 18, 2020 Hi all, I perfectly know the error in subject. It is due of an ancestor form\datamodule missing in the project (don't go deep in all other sub-cases this error can happen...). In my dpr I have all of the ancestors, and if I open them in IDE in the correct order (grandfather - father - child) everything is fine. BUT if I open only a "child" then this error happens. My project is a bit complicated (I make use of injection, threads, etc.) but this simple error is making me and my team crazy. Any idea how to solve this situation? The object tree is something like: TBaseDatamodule |- TChildDatamodule |-- TConcreteDatamodule Thanks in advance, Eddy Share this post Link to post
Anders Melander 1783 Posted May 18, 2020 https://stackoverflow.com/questions/4518521/delphi-how-to-get-rid-of-ancestor-of-tmyform-not-found-error TL;DR Make sure all data modules (and forms) are declared in the DPR uses list on the form: <unit name> in '<file name>' {<instance variable name>: <base type>}, e.g. ModuleFoo in 'datamodules\ModuleFoo.pas' {DataModuleFoo: TDataModule}, I'm guessing this should work too: ModuleFoo in 'datamodules\ModuleFoo.pas' {TDataModule}, Share this post Link to post
Sonjli 6 Posted May 18, 2020 Everything is exactly as you write. Every datamodule is correctly declared in dpr with path and comment. Real code: ... UInterfacedDataModule in '..\..\..\Model\UInterfacedDataModule.pas' {DMInterfacedDatamodule: TDataModule}, UDMCustomModel in '..\..\..\UDMCustomModel.pas' {DMCustomModel: TDataModule}, UDMUniModel in '..\..\..\Model\UniModel\UDMUniModel.pas' {DMUniModel: TDataModule}, ... Share this post Link to post
Anders Melander 1783 Posted May 18, 2020 32 minutes ago, Sonjli said: Everything is exactly as you write. Every datamodule is correctly declared in dpr with path and comment. Then I'm afraid I can't reproduce the problem. Can you attach a minimal project (just the dpr, dproj and two datamodule units) which reproduces the problem. And please state what version of Delphi you're using. Share this post Link to post
Sonjli 6 Posted May 18, 2020 My dpr is not exactly canonical... so, is there any problem with IDE ancestor resolution and "strange" disposition of dpr code? For example I have a wrapper object for "Application", so there is no standard Application.createForm(); Application.Initialize; Application.Run; Can this be a problem? I didn't try to make a cosole app (my apps are similar to console applications) with my datamodules, in fact... I can try Share this post Link to post
Guest Posted May 18, 2020 Why not to start debug your application the right way ? If you don't have a file logger, then simply use OutputDebugString in all of you units, use it directly or with wrapper method, you also can add a directive to enable it when you need for later usage. Use OutputDebugString in initialization and finalization in every unit ( you can also add it in the dpr file itself) , download DebugView from here https://docs.microsoft.com/en-us/sysinternals/downloads/debugview The output messages will be captured in DebugView when your application outside the IDE debugger, while the Debugger messages ( Events windows) will capture the text, save both outsputs to text files, compare and you will find what is going wrong. Such process will take 5 minutes of your time and will give you 100% accurate picture what had been changed, no matter how complicated your application is. Share this post Link to post
Guest Posted May 18, 2020 And yes i forgot to mention add it to modules constructor and destructor, i think you got the idea. Share this post Link to post
Sonjli 6 Posted May 19, 2020 7 hours ago, Kas Ob. said: Why not to start debug your application the right way ? If you don't have a file logger, then simply use OutputDebugString in all of you units, use it directly or with wrapper method, you also can add a directive to enable it when you need for later usage. Use OutputDebugString in initialization and finalization in every unit ( you can also add it in the dpr file itself) , download DebugView from here https://docs.microsoft.com/en-us/sysinternals/downloads/debugview The output messages will be captured in DebugView when your application outside the IDE debugger, while the Debugger messages ( Events windows) will capture the text, save both outsputs to text files, compare and you will find what is going wrong. Such process will take 5 minutes of your time and will give you 100% accurate picture what had been changed, no matter how complicated your application is. Sorry @Kas Ob. but my problem is at designtime, not runtime. The problem happens in IDE. thanks. Share this post Link to post
Uwe Raabe 2057 Posted May 19, 2020 You can also check the dproj file the DesignClass and FormType values to be correct. <DCCReference Include="Unit527.pas"> <Form>DataModule527</Form> <FormType>dfm</FormType> <DesignClass>TDataModule</DesignClass> </DCCReference> Share this post Link to post
Lars Fosdal 1792 Posted May 19, 2020 What about registering the base form? Open form, right click, register Share this post Link to post
Sonjli 6 Posted May 19, 2020 3 hours ago, Uwe Raabe said: You can also check the dproj file the DesignClass and FormType values to be correct. <DCCReference Include="Unit527.pas"> <Form>DataModule527</Form> <FormType>dfm</FormType> <DesignClass>TDataModule</DesignClass> </DCCReference> Ciao Uwe, I try asap... never touched the dproj :B thanks Share this post Link to post
Sonjli 6 Posted May 19, 2020 2 hours ago, Lars Fosdal said: What about registering the base form? Open form, right click, register sorry... what!? I have the register only on frames, not on TdataModules, am I wrong? Share this post Link to post
Sonjli 6 Posted May 19, 2020 3 hours ago, Uwe Raabe said: You can also check the dproj file the DesignClass and FormType values to be correct. <DCCReference Include="Unit527.pas"> <Form>DataModule527</Form> <FormType>dfm</FormType> <DesignClass>TDataModule</DesignClass> </DCCReference> Ok,I tried but they are all ok... Share this post Link to post
Anders Melander 1783 Posted May 19, 2020 Is something preventing you from posting a minimal project that reproduces the problem, so we can avoid this pointless guesswork? Share this post Link to post
Sonjli 6 Posted May 19, 2020 3 hours ago, Anders Melander said: Is something preventing you from posting a minimal project that reproduces the problem, so we can avoid this pointless guesswork? I can try... 1 Share this post Link to post