views:

159

answers:

2

Hello StackOverflow,

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!

+4  A: 

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.

Larry Lustig
A: 

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.

birger