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 Implement an OnEndResize event for a TForm 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 2.x
Views
98
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

Any idea how to implement an OnEndResize event for TForm? Obviously, it should be 
fired when the user finishes resizing the form.

Answer:

You'll need to handle WM_SYSCOMMAND and WM_EXITSIZEMOVE. Here's a framework to get 
you started:

1   unit Unit1;
2   
3   interface
4   
5   uses
6     Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
7   StdCtrls;
8   
9   type
10    TForm1 = class(TForm)
11      ListBox1: TListBox;
12    private
13      { Private declarations }
14      FSizing: Boolean;
15      procedure WMEnterSizeMove(var AMessage: TMessage); message WM_ENTERSIZEMOVE;
16      procedure WMExitSizeMove(var AMessage: TMessage); message WM_EXITSIZEMOVE;
17      { procedure WMSize(var AMessage: TMessage); message WM_SIZE; }
18      procedure WMSysCommand(var AMessage: TMessage); message WM_SYSCOMMAND;
19    public
20      { Public declarations }
21    end;
22  
23  var
24    Form1: TForm1;
25  
26  implementation
27  
28  {$R *.DFM}
29  
30  procedure TForm1.WMSysCommand(var AMessage: TMessage);
31  begin
32    if (AMessage.WParam and $FFF0) = SC_SIZE then
33    begin
34      FSizing := true;
35      ListBox1.Items.Add(Format('SysCommand called - message: %d:%d',
36        [AMessage.WParam, AMessage.LParam]));
37    end;
38    inherited; {Note: inherited after testing for SC_SIZE}
39  end;
40  
41  procedure TForm1.WMExitSizeMove(var AMessage: TMessage);
42  begin
43    inherited;
44    ListBox1.Items.Add(Format('ExitSizeMove called - message: %d:%d',
45      [AMessage.WParam, AMessage.LParam]));
46    if FSizing then
47    begin
48      {Do your stuff here}
49      FSizing := false;
50    end;
51  end;
52  
53  procedure TForm1.WMEnterSizeMove(var AMessage: TMessage);
54  begin
55    inherited;
56    ListBox1.Items.Add(Format('EnterSizeMove called - message: %d:%d',
57      [AMessage.WParam, AMessage.LParam]));
58  end;
59  
60  {
61  procedure TForm1.WMSize(var AMessage: TMessage);
62  begin
63    inherited;
64    ListBox1.Items.Add(Format('Size called - message: %d:%d', [AMessage.WParam,
65                                        AMessage.LParam]));
66    FSizing := true;
67  end;
68  }
69  
70  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