Board index » delphi » Form moving event

Form moving event

On Mon, 16 Feb 1998 13:38:57 +0200, J van Wyk <jvvan...@econ.up.ac.za>
wrote:

Quote
>Is there some way of telling when a form is being dragged around in Delphi
>3?

WM_WINDOWPOSChanging and WM_WINDOWPOSCHANGED messages

---
Yorai Aminov
El-On Software Systems
http://ourworld.compuserve.com/homepages/yaminov

 

Re:Form moving event


Jacques:

Handle WM_WINDOWPOSChanging with something like:

type
  TForm1 = class(TForm)
    Label1: TLabel;
  private
    procedure WMWindowPosChanging(var AMessage: TWMWindowPosChanging);
      message WM_WINDOWPOSChanging;
  public
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.WMWindowPosChanging(var AMessage: TWMWindowPosChanging);
begin
  if AMessage.WindowPos^.x < 12 then
    AMessage.WindowPos^.flags := AMessage.WindowPos^.flags or SWP_NOMOVE;

  inherited;

  Label1.Caption := IntToStr(Left) + ':' + IntToStr(Top);
end;
--
Regards
Ralph (TeamB)
Herrsching, Germany

    J van Wyk wrote in message <34E82550.ED7FE...@econ.up.ac.za>...
    Is there some way of telling when a form is being dragged around in
Delphi 3?
    The only way I have figured out is with the form's OnPaint event, but
this only happens afterwards.
    Jacques

Other Threads