Delphi: Define FormStyle fsMDIChild or fsNormal at runtime
I have a Vcl.Form that is a MDIChild (FormStyle=fsMDIChild). No I have the requirement that I need this form also as a modal dialog. I tried to change the FormStyle at runtime but that does not work.
In the VCL documentation I found a remark that FormStyle should not be changed at runtime. That's obiously the reason why it doesn't work. A workaround would be to have a copy of that form so that one form has FormStyle=fsNormal and the other FormStyle=fsMDIChild. But this is a maintenance nightmare.
Can somebody help me find a solution to that problem? Maybe someone has a better workaround, etc.?
I suggest to use TFrame container. It is like TForm but without border. So, add TFrame to project. Add all components and code to that unit like you do on your form. Then you can create TForm on runtime as TMdiChild or Dialog. This is the way to put your frame control to other form....
... when you want to create dialog:
Open in new window
... when you want to put frame on form as mdichild:
Open in new window
... when you put frame on main form which is not mdiparent but simple form
(can be your TPanel component if want):
Open in new window