Ian Branch 127 Posted December 6, 2019 Hi Team, Question 1. What are the consequences/pros & cons of using MyForm.Create(nil).show; v MyForm.Create(self).show;? Question 2. I have asked this somewhere/sometime in the past but I don't recall where/when or the answer. When I open some projects they open showing the form, others open showing the source code and yet other open not showing either. Annoying.. Where is this information kept/save so I can set or reset it so I get them to all open the same please? If I in fact can... Regards & TIA, Ian Share this post Link to post
David Heffernan 2345 Posted December 6, 2019 (edited) The version without the owner leaks. Potentially there could be issues with popup parent also. Which form do you want to be the popup parent? Although I could be wrong on that one. I'm not sure that the framework looks at the component owner to determine the popup parent in auto mode. Edited December 6, 2019 by David Heffernan Share this post Link to post
Uwe Raabe 2058 Posted December 6, 2019 7 hours ago, Ian Branch said: When I open some projects they open showing the form, others open showing the source code and yet other open not showing either. Annoying.. Where is this information kept/save so I can set or reset it so I get them to all open the same please? This information is buried inside the DSK file of the project. Inspect the View<n> section for the source file in question and note the EditViewName entry. For the source view to be visible it contains the PAS file name, while for the design view it says Borland.FormDesignerView. Note that the the last state is stored and overwrites your changes when the IDE options are set to store the current desktop on close. Share this post Link to post
Ian Branch 127 Posted December 6, 2019 David - Thank you. I'll stick to MyForm.create(self).show I think. UWE - Thank you. I have found the Option and have set it now. Regards & Tks to both. Ian Share this post Link to post
Remy Lebeau 1400 Posted December 6, 2019 (edited) 10 hours ago, David Heffernan said: The version without the owner leaks. Unless the Form has an OnClose event handler that sets the Action parameter to caFree, allowing the Form to free itself when it is closed. This is a common idiom when using Show() instead of ShowModal(). Quote Potentially there could be issues with popup parent also. Which form do you want to be the popup parent? Although I could be wrong on that one. I'm not sure that the framework looks at the component owner to determine the popup parent in auto mode. It does not look at the Owner at all. Nor could it anyway, because the Owner may not be a TWinControl at all. Candidates for an auto-assigned PopupParent include the Application's ActiveForm, the Application's MainForm, the Screen's ActiveForm, and the Application window. Edited December 6, 2019 by Remy Lebeau 1 Share this post Link to post
David Heffernan 2345 Posted December 7, 2019 10 hours ago, Remy Lebeau said: Nor could it anyway, because the Owner may not be a TWinControl at all. Well, it easily could if it would use runtime type testing, the is operator. My framework does it this way. Share this post Link to post