Is it possible for a Delphi application to receive a dfm file with objects, its properties and event assignments, and load up all those information just like when how they d
You are presented a DFM form design file, and you want to instantiate it?
Without the accompanying PAS source file, this is not possible. You need the implementation of how the class acts and interacts. (If there is no implementation, i.e. the DFM does not refer to event handlers, then you could create a class at runtime if you have or parse the classname from the DFM. But you would have to know or parse all published members of the form class, thus making this solution kind of academical).
Even if you have the source file, you would need it at compile time in order to be able to create the class.
If you have both design and source files at compile time, then add them to the project and you would not need to load the form from file since it is included in the executable's resources. Just use the default constructor Create
at runtime to create the form.
When you have a secondary DFM form file for a single PAS source file, then use this kind of trick to create with the CreateNew
constructor an alternative form object (e.g. with some controls hidden or styled) based on the same code.
If your DFM file is at runtime created from a specific state of the form, then create the form as normal but restore that particular state with one of the answers to this question.