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 SetWindowPos und Frames (https://www.delphipraxis.net/135042-setwindowpos-und-frames.html)

jping 3. Jun 2009 17:19


SetWindowPos und Frames
 
Hallo,

hab schon Google schon fleißig bemüht, aber leider keine Lösung gefunden.

Ich habe ein Frame erstellt und möchte dies gerne an einer beliebigen Stelle anzeigen.
Habe dafür folgende Prozedur erstellt:

procedure TFrameMyFrame.SetVisible(const Value: Boolean);
var
i : Integer;
begin
FVisible := Value;
if HandleAllocated then begin
if FVisible
then SetWindowPos(Handle, HWND_TOPMOST, Left, Top, Width, Height, SWP_SHOWWINDOW or SWP_NOACTIVATE)
else SetWindowPos(Handle, HWND_TOPMOST, Left, Top, Width, Height, SWP_HIDEWINDOW or SWP_NOACTIVATE);
InvalidateRect(Handle, nil, True);
end;
end;

Außerdem:

procedure TFrameMyFrame.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
with Params do begin
Style := WS_POPUP;{ or WS_BORDER;}
WindowClass.Style := WindowClass.Style or CS_SAVEBITS;
ExStyle := WS_EX_TOOLWINDOW or WS_EX_NOACTIVATE;
AddBiDiModeExStyle(ExStyle);
end;
end;

Wenn ich visible auf True setze wird mir an der Stelle nur ein graues Rechteck angezeigt.
Wie kann ich auch die Komponenten auf dem Frame anzeigen lassen?
Ich benutze Delphi 2007.

Vielen Dank schonmal.

Gruß
Jörg

jaenicke 3. Jun 2009 17:34

Re: SetWindowPos und Frames
 
Verstehe ich das richtig? Du willst ein TFrame als Fenster anzeigen? Warum nimmst du kein Formular? :gruebel:

quendolineDD 3. Jun 2009 17:41

Re: SetWindowPos und Frames
 
AFAIK kann ein TFrame nicht allein als Fenster agieren. Dafür gibt es TForm.

jping 4. Jun 2009 07:56

Re: SetWindowPos und Frames
 
Hallo,

ich hatte gehofft, dass ich es so schaffe, dass dem Hauptformular nicht der Fokus geklaut wird, wenn man
auf das neue Fenster klickt.
Funktioniert allerdings auch nicht mit einem Frame, wenn ich auf das neue Fenster klicke
wird das Hauptformular trotzdem inaktiv.

Wie kann ich es sonst schaffen, dass immer nur das Hauptformular aktiv ist?
Ähnlich wie ein Popup.

Gruß
Jörg

Sherlock 4. Jun 2009 08:08

Re: SetWindowPos und Frames
 
Machs nicht anklickbar...disabled oder so.
Wenn es allerdings Controls enthält, die bedient werden sollen dann geht das nicht, ist dann allerdings auch nicht sinnvoll.

Sherlock

jping 4. Jun 2009 08:46

Re: SetWindowPos und Frames
 
Naja, eigentlich sollte das schon gehen:

WS_EX_NOACTIVATE
Windows 2000/XP: A top-level window created with this style does not become the foreground window when the user clicks it. The system does not bring this window to the foreground when the user minimizes or closes the foreground window.
To activate the window, use the SetActiveWindow or SetForegroundWindow function.

Aber das funktioniert leider nicht :?

Gruß
Jörg


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