Solved

Detecting when a form is restored to original size

Posted on 2002-06-22
4
166 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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…

895 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

12 Experts available now in Live!

Get 1:1 Help Now