Solved

Detecting when a form is restored to original size

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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