Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   ApplicationEvents (https://www.delphipraxis.net/206921-applicationevents.html)

nezumi7 9. Feb 2021 10:00

ApplicationEvents
 
Hallo zusammen,

Ich habe zwei Forms, bei denen Form2 immer über einem Teil von Form1 liegen muss, auch wenn ich auf nicht überdeckte Bereiche von Form1 zugreife (das muss ich können, deshalb geht Form2.ShowModal schon mal nicht).

Daher habe ich bei Form2.Formstyle auf fsstayontop gesetzt. Das würde mir im Prinzip reichen, allerdings kommt es dann vor, dass sich ein anderes aktives Fenster (welches den Fokus bekommt) zwischen Form1 und Form2 schiebt. Form1 auch auf stayontop setzen, will ich nicht.

daher war meine Idee:

Delphi-Quellcode:
procedure TForm1.ApplicationEvents1Deactivate(Sender: TObject);
begin
form2.FormStyle := fsnormal;
end;

procedure TForm1.ApplicationEvents1Activate(Sender: TObject);
begin
form2.FormStyle := fsstayontop;
end;
Leider hat das nicht den gewünschten Erfolg: ein nicht programmeigenes Fenster, welches aktiv wird, ist dann zwischen form1 und form2. Irgendwas mache ich falsch bei diesen ApplicationEvents. Kann mir jemand einen Tipp geben?

himitsu 9. Feb 2021 11:34

AW: ApplicationEvents
 
Lass bloß die Finger vom StayOnTop.
Erstmal ist das Global und nicht nur für dein Programm
und dann macht das einfach nur massiv Probleme.

Beispiel: Eine MessageBox oder Fehlermeldung geht auf, die liegt hinter dem StayOnTop und weil niemand das Fenster sieht, denkt man das Programm hängt. (wegen ShowModal sind ja alle anderen Fenster gesperrt)



Delphi-Quellcode:
// bei Form2
PopupMode := pmExplicit;
PopupParent := Form1;
Und schon ist Form2 immer vor/über Form1.

nezumi7 9. Feb 2021 11:52

AW: ApplicationEvents
 
Super, danke!:thumb:

Ich freu mich auch immer über solche Hinweise,

"Lass bloß die Finger vom StayOnTop."

weil mir als reiner Hobbyprogrammierer total die Grundlagen fehlen und ich oft nicht weiß, warum es knirscht und knarzt im Gebälk....


Alle Zeitangaben in WEZ +1. Es ist jetzt 03:55 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz