You should determine if you forms would be auto-created or created on demand.
You should also decide which form would be main one.
The corner question would be if you can have several open forms of the same class, for example if you made "File Viewer" form there may be sense to have several of them open for different files.
For auto-created forms:
1.1 Open project source (.dpr file, Project/View Source menu) or open Project options in Forms section. Set MenuForm the 1st (topmost) one in creation list.
1.2 Check that all other forms have their .visible
property false
2: Depending on the logic of your program you should use Form1.Show or Form1.ShowModal
3: Self.Close or Self.Hide or Self.Visible := false. Better 1st: http://docwiki.embarcadero.com/Libraries/XE2/en/Vcl.Forms.TCustomForm.Close
If u use OnClose event of those forms - ensure you did not changed default caHide action for closing
For manually lifetime controlled forms:
1: Open project source (.dpr file, Project/View Source menu) or open Project options in Forms section. Set MenuForm the only one created.
2.1. some-temporary-variable := TFormClass.Create(Application);
2.2. Then you tweak some properties of some-temporary-variable
like filename to open or some data source or whatever.
2.3. Then you do some-temporary-variable.Show
or some-temporary-variable.ShowModal
.
Beware: using ShowModal may freeze your application, in cases like TFormClass.Create(SomeAnotherForm)
, use Application for parent.
3: Self.Release http://docwiki.embarcadero.com/Libraries/XE2/en/Vcl.Forms.TCustomForm.Release
or Self.Close and specify caFree
action in OnClose event - http://docwiki.embarcadero.com/Libraries/XE2/en/Vcl.Forms.TCustomForm.OnClose