![]() |
Form erstellen
Hallo,
ich erstelle per code eine Form. Wenn ich jetzt eine erzeugt habe, bekommt diese ja auch sofort den Focus. Kann ich das irgendwie verhindern? Also ich will eine Form erzeugen, ohne das diese sofort den Focus an sich reist. Danke für eure Hilfe Matthias |
Re: Form erstellen
hallo Matthias,
vom Erzeugen alleine bekommt die Form wohl nicht den Focus, eher vom ShowModal oder Show. :-) Für solche Fälle merke ich mir das vorherig aktive Form, zeige das neue an und gebe den Focus dem vorherigen danach zurück.
Delphi-Quellcode:
Roderich
PreviousForm := Screen.ActiveForm;
NewForm := TNewForm.Create(Application); NewForm.Show; if Assigned(PreviousForm) then PreviousForm.SetFocus; |
Re: Form erstellen
Hallo,
so ähnlich hab ichs bis jetzt auch. Ich verwende momentan folgenden Code:
Delphi-Quellcode:
Das Ergebnis ist, das die Titelleiste des Formulars in dem ich das andere erzeuge gelegentlich kurz blinkt.
PForm := GetParentForm(Self);
if PForm <> nil then PForm.Perform(WM_NCACTIVATE,1,0); Das wolte ich natürlich vermeiden Mfg Matthias |
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:51 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz