帮助基于数据库表(脚手架?)生成 Delphi DFM

发布于 2024-09-12 15:34:29 字数 430 浏览 12 评论 0原文

我是delphi的新手,我正在寻找方法来了解更多有关delphi底层技术的信息,并在这个过程中在我的工作中做一些有用的事情,如果有人有任何提示或看到无论如何我可以改进我的想法,请自由说出你的想法...

我想为 dfms 制作某种脚手架,其想法如下:我想基于 firebird 数据库表生成 - 具有明确定义的域 - 大部分 Form 。

我认为这个想法太简单了,或者我没有看到使它变得困难的大局,我试图不重新发明井,我已经在谷歌上查找过,但没有好的结果,所以如果有人能给我一个方向在此我将不胜感激。

更新: @Larry Lustig 谢谢,我没有考虑过 delphi 框架 - 我要去查找它们。

我了解一些关于表单对象/处理和数据库元数据的知识,但我不熟悉将delphi对象序列化到HD。任何关于序列化和delphi框架的提示(开源所以我可以看看:))将受到欢迎!

I'm new to delphi and I'm looking up on ways to learn more about delphi underlying technology plus make something useful here in my job in the process, also if anyone has any tip or see anyway i can improve my idea please fell free to speak your mind...

i want to do make some kind of Scaffolding for dfms, the ideia is the following: i want to generate based on a firebird database table - with well defined domains - the bulk of the Form .

I think the idea is too simple or i'm not seeing the big picture that makes it difficult, i'm trying not to reinvent the well, i've looked up on google but without good results, so if anyone could giveme a direction here i would be most grateful.

UPDATE:
@Larry Lustig thanks, i didn't think about delphi frameworks - i'm going to look them up.

i know something about form objects/handling and database metadata, but i'm unfamiliar with serilizing delphi objects to the HD. Any tips on Serialization and delphi frameworks (opensource so i could take a look :) ) would be welcome!

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

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

发布评论

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

评论(2

相思碎 2024-09-19 15:34:29

听起来是个有趣的想法。

我将使用以下方法,而不是在磁盘上手动编写 DFM 表单:

  • 通过检查元数据来获取表的结构。
  • 创建一个 TForm 并为要表示的每一列添加一个控件。
  • 使用 Delphi 的内置序列化将表单保存到磁盘。

我自己还没有这样做,但是有许多运行时设计框架都使用了这个想法。

Sounds like an interesting idea.

Instead of writing a DFM form manually on disk I would use the following approach:

  • Get the structure of your table by examining the meta data.
  • Create a TForm and add a control to it for each column you want to represent.
  • Use Delphi's built in serialization to save the form to disk.

I haven't done this myself, but there are a number of run-time design frameworks that work using this idea.

别在捏我脸啦 2024-09-19 15:34:29

仅当您需要在设计时构建大量表单时,这才有意义。您不能在可执行文件中使用 DFM。如果您想构建表单运行时,我建议您采用 Larry Lustig 的答案。

我们更进一步……我们不构建表单。我们只编写类,添加一些属性并在运行时创建表单。用户可以在运行时更改此预设表单布局并保存自己的布局。控件和数据库之间的数据绑定是通过优秀的 tiOPF 框架完成的。也许您也可以考虑使用一些东西。

This would only make sense if you need to build a lot of forms at design time. You can't use the DFM's in your executable's. If you want to build the forms runtime, I suggest you go with Larry Lustig's answer.

We have taken this one step further... we don't build forms. We only write the classes, add some attributes and create the forms at runtime. Users can change this preset form layout during runtime and save their own layout. Data binding between the controls and the database is done with the excellent tiOPF framework. Maybe something you can consider to use as well.

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