为什么一个模块在加载另一个模块之前无法保存?

发布于 2024-08-24 13:10:05 字数 592 浏览 3 评论 0原文

我工作的大多数单元都依赖于数据模块。我遇到的最烦人的事情之一是一条错误消息告诉我

模块 X 引用了另一个模块,并且在加载模块 Y 之前无法保存。

现在,我确信 CheckNoFixups 在尝试 WriteRootStream 时引发此错误,并且无法保存有效的文本文件(希望如此)是有充分理由的这之后不会发生灾难性故障,我必须重新启动 IDE,同时仍然无法保存我的工作。)但是,好的理由是什么?

为什么我无法在不打开包含各种功能和对象的文本文件的情况下单击“保存”,就像任何其他单元一样? DataModule 有什么特别之处,这意味着我无法保存正在处理的源代码,直到它打开为止,为什么 use 子句中的 45 个其他单元不是那么重要,它们必须打开?

编辑: 这是 Delphi 2007,

DataModule 的声明是:

unit DataMD;

TRepDataMod = class(TDataModule)
...
var
  RepDataMod: TRepDataMod;

Most of the units I work on rely on a Data Module. One of the most annoying things I come accross is an error message telling me

Module X references another module and cannot be saved until Module Y is loaded.

Now, I'm sure there is a very good reason why CheckNoFixups raises this error while trying to WriteRootStream, and fails to save what is in effect a Text file (and hopefully this isn't followed by Catastrophic Failure where I must then restart the IDE while still unable to save my work.) but what is the good reason?

Why am I unable to click save without opening anothing text file containing various functions and objects much like any other unit? whats so special about a DataModule that means I can't save the source I'm working on until it's open, why aren't the 45 other units in the uses clause so important they must be open?

EDIT:
It's Delphi 2007

the Declaration of the DataModule is :

unit DataMD;

TRepDataMod = class(TDataModule)
...
var
  RepDataMod: TRepDataMod;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

魂ガ小子 2024-08-31 13:10:05

如果 DataModule 不是打开的项目的一部分,则表单中引用 DataModule 的数据感知对象将无法验证它们的引用,我认为因此会出现该消息。

我仅在将旧项目移植到新的 Delphi 版本或迁移到一组新的数据库组件时才看到此消息。正常情况下我没有遇到过这个消息。

在早期版本中,我没有看到该消息,并且可以保存表格/单位,但是 dfm 中的引用被神奇地删除了。

If the DataModule is not part of the opened project the data aware objects in your form that reference the DataModule, cannot verify their reference and I think therefore the message comes up.

I only seen this message when I was porting an older project to a new Delphi version or were migrating to a new set of database components. In normal circumstances I haven't encountered this message.

In earlier versions I haven't seen the message and the form/unit could be saved, but the references that were in your dfm were magicly deleted.

温柔少女心 2024-08-31 13:10:05

我有同样的问题(Delphi 7)。

我在数据模块上有一个图像列表,供整个应用程序使用。如果存在语法错误,它会在编译之后发生。 IDE 打开 (pas) 文件,我可以更正错误。

但尝试保存文件会显示该消息(“模块‘XXX’链接到模块‘YYY’,在当前项目中找不到该模块。您希望删除/重定向到另一个模块的链接吗?”)。 XXX 是文件本身,YYY 是数据模块。数据模块包含在项目中,对该问题回答“是”将删除 dfm 文件中的所有链接。

因此,唯一的解决方案是按“否”,这基本上会保存 pas 文件并关闭该文件 - 这次对于是否应保存文件的问题按“否”(实际上 pas 已保存)。

我已经尝试了各种解决方法,但仍在挣扎。

I have the same issue (Delphi 7).

I have an imagelist on a datamodule for usage throughout the whole application. It happens after a compile, if there is an syntax error. The IDE opens the (pas) file and I can correct the error.

But trying to save the file shows that message ("Module 'XXX' links to module 'YYY' which cannot be found in the current project. Do you whish to remove/redirect the links to another module?"). XXX is the file itself and YYY is the datamodule. The datamodule is included in the project and answering "Yes" to that question would remove all links in the dfm file.

So the only solution is pressing "No", which basically saves the pas file and close the file in the - this time pressing "No" to the question if the file should be saved (the pas is in fact already saved).

I have allready tried various workarounds butstill struggling.

那片花海 2024-08-31 13:10:05

无论如何,我在表单上的框架上遇到了同样的问题。我最终通过删除框架并再次将其添加回来来修复它。我确保在将框架添加回表单后,所有事件处理程序都已重新连接。

For what it's worth, I encountered the same problem with a frame on a form. I finally fixed it by removing the frame and adding it back again. I made sure that any event handlers were hooked back up after adding the frame back to the form.

故事和酒 2024-08-31 13:10:05

模块 X 引用了另一个模块,并且在加载模块 Y 之前无法保存。

只需查看 X.dfm (X.fmx) 中的“Y”条目即可。如何处理它们,这是你的选择。

Module X references another module and cannot be saved until Module Y is loaded.

Just look over X.dfm (X.fmx) for "Y" entries. What to do with them, it's your choise.

离线来电— 2024-08-31 13:10:05

确保 DataModule 是项目的一部分。仅包含在搜索路径中或手动输入 dpr 文件是不够的。通过 IDE 并将 DataModule 添加到项目中。

还要确保 DataModule dfm-resource 与单元具有相同的名称。

Make sure DataModule is part of the project. Not enough just to include on search-path or enter into dpr-file manually. Go through IDE and add the DataModule to the project.

Also make sure the DataModule dfm-resource has the same name as the unit.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文