Autor Beitrag
the_immortal
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 78



BeitragVerfasst: Mi 19.10.05 10:23 
Ich möchte ein Form2, das ich vom Form1 per show öffne während dem es gezeigt wird modal setzten. Jedoch habe ich das prob, dass wenn ich das Form2 mit showmodal öffne ich es dann vom Form1 aus nicht mehr schliessen kann!


Moderiert von user profile iconGausi: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Mi 19.10.2005 um 11:26
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mi 19.10.05 10:29 
Das hab ich jetzt nicht verstanden. :gruebel:

Du willst also Form2 erst zeigen (mit show, Zugriff auf Form1 weiter möglich). Dann möchtest du Form2 "modal" machen, also Form1 deaktivieren. Direkt mit Showmodal möchtest du es nicht machen, weil dann Form1 deaktiviert ist. Genauso, wie wenn man es erst zeigt und dann modal macht.

Warum?

_________________
We are, we were and will not be.
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: Mi 19.10.05 11:28 
möchtest du, dass Form 2 immer im Vordergrund ist?
Wenn ja, setzt mal den WindowStyle auf wsStayOnTop.

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)
the_immortal Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 78



BeitragVerfasst: Mi 19.10.05 12:55 
user profile iconGSE hat folgendes geschrieben:
möchtest du, dass Form 2 immer im Vordergrund ist?
Wenn ja, setzt mal den WindowStyle auf wsStayOnTop.

mfg
GSE


genau und auf das Form1 aus welchem das Form2 geöffnet wurde, sollte auf keinen Fall zugegriffen werden können, ich hab jetzt einfach das Form1 auf enabled := false gestellt; weiss nicht vielleicht ist das ein bisschen unelegant ???
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: Mi 19.10.05 15:22 
Zitat:
Jedoch habe ich das prob, dass wenn ich das Form2 mit showmodal öffne ich es dann vom Form1 aus nicht mehr schliessen kann!

Zitat:
genau und auf das Form1 aus welchem das Form2 geöffnet wurde, sollte auf keinen Fall zugegriffen werden können.

ha' ich 'nen Denkfehler oder widerspricht sich das wirklich?

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)
Wollaston
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Mi 19.10.05 17:32 
Wenn ich das richtig verstehe, dann soll auf Form1 bis auf das Schließen keine Funktion ausführbar sein wenn Form2 sichtbar ist.

Leg Deine Componenten auf ein Panel und wenn Du Form2.Show ausführst setzt Du einfach Panel.Enabled auf False. Wenn Du dann noch wie zuvor beschrieben Form2 auf StayOnTop setzt hast Du alles.
Beim schließen von Form2 setzt Du dann einfach wieder Panel.Enabled auf True.

Dann kann keiner auf Form1 etwas ausführen aber das Prog kann komplett über Form1 geschlossen werden.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mi 19.10.05 18:30 
TCustomForm.ShowModal ist eine asynchrone Funktion, d.h. sie kehrt erst zurück, wenn die Operation fertig ausgeführt ist.

Wenn Du aus Form1 dennoch Form2 schließen willst, musst Du dir einen Handler in Form1 definieren, der Form2.ModalResult auf einen Wert <> mrNone setzt ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
the_immortal Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 78



BeitragVerfasst: Do 20.10.05 14:02 
Wie kann ich wenn ich form2 aus dem form1 mit close schliesse den focus dannach wieder zurück auf's form1 setzten?

Wenn ich das prog laufen lasse und z.B noch den winamp on habe und das Form2 aus dem Form1 schliesse ist dannach der winamp on top (focused)
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Do 20.10.05 17:11 
Sollte IIRC mit SetFocus gehen ;-)

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.