Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to detect a form movement Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
28-Oct-02
Category
VCL-Forms
Language
Delphi All Versions
Views
68
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

How to detect a form movement

Answer:

Solve 1:

1   type
2     TForm1 = class(TForm)
3     private
4       { Private declarations }
5       procedure WMEXITSIZEMOVE(var message: TMessage); message WM_EXITSIZEMOVE;
6       procedure WMENTERSIZEMOVE(var message: TMessage); message WM_ENTERSIZEMOVE;
7   
8   implementation
9   
10  procedure TForm1.WMENTERSIZEMOVE(var message: TMessage);
11  begin
12    Form1.Caption := 'Starting moving and sizing';
13  end;
14  
15  procedure TForm1.WMEXITSIZEMOVE(var message: TMessage);
16  begin
17    Form1.Caption := 'Finished moving and sizing';
18  end;



Solve 2:

Handle the WM_MOVING or WM_WINDOWPOSCHANGING message from windows, i.e.:

19  { Private declarations }
20  
21  procedure WMWINDOWPOSCHANGING(var msg: TWMWINDOWPOSCHANGING);
22    message WM_WINDOWPOSCHANGING;
23  
24  procedure TForm1.WMWINDOWPOSCHANGING(var msg: TWMWINDOWPOSCHANGING);
25  var
26    r: TRect;
27  begin
28    if ((SWP_NOMOVE or SWP_NOSIZE) and msg.WindowPos^.flags) <> (SWP_NOMOVE
29      or SWP_NOSIZE) then
30    begin
31      { Window is moved or sized, get usable screen area }
32      { Do something here }
33    end;
34    inherited;
35  end;



			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC