Solved

Detecting when a form is restored to original size

Posted on 2002-06-22
4
169 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to debug For loops? 3 63
Installshield for Embarcadero EX 10.1 Berlin 4 72
enhance the following code 3 42
Delphi: sending SMS on android platform 1 65
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…

749 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