Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Form erstellen (https://www.delphipraxis.net/26171-form-erstellen.html)

MatthiasW 19. Jul 2004 17:20


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

roderich 19. Jul 2004 17:54

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:
  PreviousForm := Screen.ActiveForm;
  NewForm := TNewForm.Create(Application);
  NewForm.Show;
  if Assigned(PreviousForm) then
    PreviousForm.SetFocus;
Roderich

MatthiasW 19. Jul 2004 20:19

Re: Form erstellen
 
Hallo,

so ähnlich hab ichs bis jetzt auch. Ich verwende momentan folgenden Code:

Delphi-Quellcode:
  PForm := GetParentForm(Self);
  if PForm <> nil then PForm.Perform(WM_NCACTIVATE,1,0);
Das Ergebnis ist, das die Titelleiste des Formulars in dem ich das andere erzeuge gelegentlich kurz blinkt.

Das wolte ich natürlich vermeiden

Mfg Matthias


Alle Zeitangaben in WEZ +1. Es ist jetzt 13:24 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