Solved

Detecting when a form is restored to original size

Posted on 2002-06-22
4
167 Views
Last Modified: 2010-04-04
Hi,

I have a number of forms that dynamicly resize panes etcetera when resized. This works fine when the user maximizes the window, but when the window is restored to its previous size, the onresize event doesn't seem to be invoked, so my panels are screwed up.

Any suggestions?

Leo aKa Oneeye
0
Comment
Question by:oneeye
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
TOndrej earned 100 total points
ID: 7101443
You can watch for WM_SYSCOMMAND message with SC_RESTORE parameter:

type
  TForm1 = class(TForm)
  private
    procedure WMSysCommand(var Message: TWMSysCommand); message WM_SYSCOMMAND;
  end;

procedure TForm1.WMSysCommand(var Message: TWMSysCommand);
begin
  inherited;
  with Message do
    case CmdType and $FFF0 of
      SC_MINIMIZE:
        ShowMessage('minimized');
      SC_MAXIMIZE:
        ShowMessage('maximized');
      SC_RESTORE:
        ShowMessage('restored'); // your panel resizing code here
    end;
end;

HTH
TOndrej
0
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 7101526
oneeye how about Anchors property ? :)
0
 

Author Comment

by:oneeye
ID: 7101763
Oddly enough, Lee, the bottom panel (where two buttons live) are anchored left, right, and bottom, but it still disappears when the size is restored.

I'll give TOndrej's code a whirl, thanks.
0
 

Author Comment

by:oneeye
ID: 7101783
Ah, Excellent. I do wonder why restoring doesn't invoke the resize method consistently, though.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Simple Delphi Question 9 89
Strange behavior when a form is closed 6 57
Base1 Encode/Decode 3 77
enhance the following code 3 28
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now