Delphi-PRAXiS
Seite 2 von 2     12   

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 ChildForm zusammen mit MainForm verschieben (https://www.delphipraxis.net/171045-childform-zusammen-mit-mainform-verschieben.html)

sundance 24. Okt 2012 07:37

AW: ChildForm zusammen mit MainForm verschieben
 
@Andreas
Vielen Dank für den Tipp; das scheint wohl der "direkteste" Weg über die VCL zu sein.

Und noch eine Frage ist aufgetaucht:
Worin liegt eigentlich der Unterschied zwischen
Delphi-Quellcode:
WM_MOVE
und
Delphi-Quellcode:
WM_MOVING
?
Die MSDN war mir da keine große Hilfe:
Zitat:

WM_MOVE: This message is sent after a window has been moved.
Zitat:

WM_MOVING: Sent to a window that the user is moving. By processing this message, an application can monitor the position of the drag rectangle and, if needed, change its position.
.sundance.

WM_CLOSE 24. Okt 2012 07:45

AW: ChildForm zusammen mit MainForm verschieben
 
Bei WM_MOVE ist die bewegung schon abgeschlossen. Außerdem sendet (soweit ich mich erinnere) WM_MOVING einige Zusatzinfos, wie die aktuelle Position mit.

sundance 24. Okt 2012 08:04

AW: ChildForm zusammen mit MainForm verschieben
 
Bei meinen Versuchen kommen während des Verschiebens, also solange die linke Maustaste gedrückt ist, bei jeder 1-Pixel-Bewegung beide Messages an. Allerdings habe ich keine Info darüber, was WM_MOVING an Daten mitschickt; bei WM_MOVE kommt über den TMessage-Parameter die X- und Y-Koordinaten der Client-Area mit.

Delphi-Quellcode:
type
  TForm1 = class(TForm)
  .
  private
    procedure WMMoving(var Msg: TMessage); message WM_MOVING;
    procedure WMEnterSizeMove(var Msg: TMessage) ; message WM_ENTERSIZEMOVE;
    procedure WMMove(var Msg: TMessage) ; message WM_MOVE;
    procedure WMExitSizeMove(var Msg: TMessage) ; message WM_EXITSIZEMOVE;
  .
  end;

procedure TForm1.WMMoving(var Msg: TMessage);
begin
  inherited;
  lbInfo.Caption :=
    Format('WM_MOVING: Client-Bereich X0 = %d, Y0 = %d',
            [Self.ClientOrigin.X, Self.ClientOrigin.Y]);
  if CheckBox1.Checked then
    ChildForm.SetBounds(Self.Left + FChildDelta.X, Self.Top + FChildDelta.Y,
                        ChildForm.Width, ChildForm.Height);
end;

procedure TForm1.WMEnterSizeMove(var Msg: TMessage);
begin
  StatusBar.SimpleText := 'Move/Resize gestartet...';
end;

procedure TForm1.WMExitSizeMove(var Msg: TMessage);
begin
  StatusBar.SimpleText := 'Move/Resize beendet!';
end;

procedure TForm1.WMMove(var Msg: TMessage);
begin
   StatusBar.SimpleText :=
     Format('MainForm wird verschoben: Client-Bereich X0 = %d, Y0 = %d',
            [TWMMove(Msg).XPos,TWMMove(Msg).YPos]);
end;

Bummi 24. Okt 2012 08:08

AW: ChildForm zusammen mit MainForm verschieben
 
Ein rect-Zeiger in lparam

DeddyH 24. Okt 2012 12:42

AW: ChildForm zusammen mit MainForm verschieben
 
Das steht aber auch im MSDN:
Zitat:

WM_MOVING message

Sent to a window that the user is moving. By processing this message, an application can monitor the position of the drag rectangle and, if needed, change its position.

A window receives this message through its WindowProc function.

Parameters

wParam

This parameter is not used.
lParam

A pointer to a RECT structure with the current position of the window, in screen coordinates. To change the position of the drag rectangle, an application must change the members of this structure.
Wenn man komplett auf VCL verzichten will, kann man dieses Rect dann nehmen, auf das andere Fenster umrechnen und das dann z.B. mit MSDN-Library durchsuchenSetWindowPos neu positionieren.


Alle Zeitangaben in WEZ +1. Es ist jetzt 09:41 Uhr.
Seite 2 von 2     12   

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