从另一个窗体访问DataModule的事件(delphi设计时) [英] Access DataModule's event from another Form (delphi design-time)
问题描述
我想知道是否有任何方法将组件的事件(As .OnClick)链接到数据模块中定义的过程(在设计时)。
此刻,我在运行时这样做:
I would like to know if there's any way to link a component's event (As .OnClick) to a procedure defined in a datamodule (At design-time). At the moment, I'm doing this at runtime:
MyButton.OnClick := MyDataModule.MyOnClickEvent;
目标是在对象检查器窗口的下拉列表中提出MyDataModule.MyOnClickEvent。
提前感谢所有分享他们知识的人:D
The goal would be that to get MyDataModule.MyOnClickEvent proposed in the dropdown lists in the Object Inspector Window. Thanks in advance to all who will share their knowledge :D
注1:
这是一个类似的问题,但是在设计时没有关于如何完成相同任务的信息:
从另一个表单访问DataModule上的事件
Note2:
唯一的方法我发现包括定义父表单上的所有事件,但我希望有一个更清洁的解决方案
Note2: The only way I found consists in define all events on a parent-form, but I was hoping there was a cleaner solution
推荐答案
我知道这样的事情是不可能的。
As far as I know something like this is not possible.
也许有一些插件,但我怀疑。为什么?
Perhaps with some addons but I doubt it. Why?
想象一下,当您尝试在具有表单和成千上万的事件的项目中尝试使用类似的东西时,将返回的所有cluter。
Imagine all the cluter that would be returned when you try using something like this on a project with hudreds of forms and thousands of events.
另外,当您在不同表单上同时使用多个事件时,如何处理?
Also how would you deal when you would have multiple events on different forms with same name?
这篇关于从另一个窗体访问DataModule的事件(delphi设计时)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!