Autor Beitrag
DelphiNoob
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152

Win 2003 Server
D7 Ent
BeitragVerfasst: Sa 08.02.03 12:29 
Hi,

Thema klingt sicher etwas dumm gewählt, aber mir fiel nichts besseres ein.

Ich habe folgendes Problem:

Ich habe einen Form (den Main Form), dieser wird wie immer bei Programmstart gestartet und ist sichtbar.

Nun möchte ich bei klick auf einen Button das ein 2ter Form (Form2) erscheint und Form1 verschwindet.

Okok, das ist bisher nicht das Problem, aber ich möchte die Teile auch aus dem Speicher haben. Und z.b. Form2 soll aus Speichergründen erst Created werden wenn form 1 geschlossen wird.

Problem ist nur: Form1.Close; geht nicht, weil das der Mainform ist. Dann schliesst sich das programm. Wenn ich Form1.Destroy; mache, dann kann ich den später nicht wieder laden. (weil man muss auch später aus form2 wieder zu form1).

Wie schaffe ich es also das auf knopfdruck sich ein form selbst SCHLIESST und sich aus dem speicher LÖSCHT, und dafür ein Definierter anderer Form erstellt.

Besser konnte ich das Problem leider nicht beschreiben, wirkt verwirrend, ich weiß! Daher vieleicht 2 mal lesen.

Mfg
Delphi Noob
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Sa 08.02.03 12:58 
Du müsstest zur Laufzeit den Mainform der Applikation ändern. :idea:
Ich hab´ aber keine Ahnung wie das funktioniert!

Über application.mainform := [TForm]
geht´s ja nicht da das eine Nur-Lesen Eigenschaft ist (Wer braucht das überhaupt? Wenn ich ein Programm erstelle kenne ich doch die Mainform, es sei denn man kann sie ändern, oder?)

Ich wette es gibt eine Möglichkeit! :twisted:

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
DelphiNoob Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152

Win 2003 Server
D7 Ent
BeitragVerfasst: Sa 08.02.03 13:08 
Wenn ich form2 zum MainForm machen könnte, dann würde das Prog bei Form1.Close; auch nicht mehr schliessen.

Nur How Do?
Steve_B
Hält's aus hier
Beiträge: 9



BeitragVerfasst: Sa 08.02.03 14:23 
Ich habe zwar nicht so ganz verstanden, was du genau vorhast, aber den?, das? MainForm müßte man im Menü unter Project --> Options bzw. Strg + SHIFT + F11 auswählen können (zumindest bei Delphi 6).
DelphiNoob Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152

Win 2003 Server
D7 Ent
BeitragVerfasst: Sa 08.02.03 14:26 
Achne ;)

Nur war das leider total am Thema vorbei. Dennoch danke für deinen Beitrag.
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Do 13.02.03 10:12 
@DelphiNoob
Um das Prog zu schließen kannst du ja auch
ausblenden Quelltext
1:
application.terminate					

aufrufen!

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
1Stein
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 30



BeitragVerfasst: Sa 15.02.03 23:08 
naja bin zwar totaler newb aber vieleicht bastelst du dir ne form als hauptform die nur dazu da is um deine "aktuelle" Mainform zu öffnen da is denn das denke ich mal benötigt weniger speicher dann könntest du die form auch ohne gleich das ganze prog zu schließen beenden naja sorry wenns net hilft wie gesagt bin totaler newb

_________________
1Stein wäre nie 1Stein geworden wenn 2Stein nicht gewesen wäre ;)