Solved

Minimize button does not minimize a form

Posted on 2003-11-06
6
416 Views
Last Modified: 2010-04-05
Even with a simple application (sample), the minimize button of the form, when you run it, does not minimize it !
I verified, that the biMinimize of BorderIcons is True.
What else has to be setup for this to work ?
0
Comment
Question by:LeTay
[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
6 Comments
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9693468
>What else has to be setup for this to work ?
Usually it works by default.
What operations have preceded to occurrence of the problem?
Do you use any "magic" components?
0
 

Author Comment

by:LeTay
ID: 9693875
Nothing special.
No magic components.
I need to find out of course what is different in that form.
Any idea of 'where' to search ?
0
 
LVL 2

Expert Comment

by:Ray_Adams
ID: 9696428
OnMinimize in form or applcation.
I don't know where to search, because i see no code.
0
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!

 
LVL 34

Expert Comment

by:Slick812
ID: 9696434
go through your form's  OnCreate  event and comment out one line at a time, and see if when you remove that line, the form will minimize,  also, do you get the  WM_SYSCOMMAND  message, that can change the minimize
0
 

Author Comment

by:LeTay
ID: 9699825
Slick812,
Will try that and keep you informed
0
 
LVL 3

Accepted Solution

by:
fibdev earned 100 total points
ID: 9709069
Sometimes you can trap yourself.  For example...

If you load the size and windowstate from the registry or an ini file in the wrong order you get a form that "appears" not to restore because the size is set after the form is maximized (did that make sence?)  look at this code snip:

This works...
========================================
procedure TSDIAppForm.FormCreate(Sender: TObject);
var i, w : integer;
begin
    FIniFileName := LowerCase(ExtractFileName(Application.ExeName));
    FIniFileName := '.\' + Copy(FIniFileName, 1, Length(FIniFileName) - 3) + 'ini';
    Ini := TInifile.Create(FIniFileName);
    // Window Dimentions
    with sdiappform do begin
      Left := ini.ReadInteger('window', 'left', 50);
      Top  := ini.ReadInteger('window', 'top', 50);
      Width := ini.ReadInteger('window', 'width', 450);
      Height := ini.ReadInteger('window', 'height', 400);
    end;
    // Windowstate
    w := ini.readinteger('Window', 'WindowState', 0);
      case w of
        0 : sdiappform.WindowState := wsNormal;
        1 : sdiappform.WindowState := wsMinimized;
        2 : sdiappform.WindowState := wsMaximized;
      end;
   // resize statusbar panels
    i := sdiappform.Width div 3;
    statusbar.Panels[0].Width := i;
    Repaint;
    Application.OnHint := DisplayHint;
    Ini.Free;
end;
=========================================

If this is recorded in the reverse order...

  If sdiappform.WindowState = wsNormal then w := 0;
  if sdiappform.WindowState = wsMinimized then w := 1;
  if sdiappform.WindowState = wsMaximized then w := 2;
  ini.WriteInteger('Window', 'WindowState', w);
  // if windowstate is not max then save current

  // dimentions...
  With sdiappform do
  begin
      // window dimentions
    Ini.WriteInteger('Window', 'Top', Top);
    Ini.WriteInteger('Window', 'Left', Left);
    Ini.WriteInteger('Window', 'Width', Width);
    Ini.WriteInteger('Window', 'Height', Height);
  end;  // Uh-Oh, your window dimentions are that of a maximized screen  :(

  // Workaround
  If windowstate <> wsMaximized then with sdiappform do
  begin
      // window dimentions
    Ini.WriteInteger('Window', 'Top', Top);
    Ini.WriteInteger('Window', 'Left', Left);
    Ini.WriteInteger('Window', 'Width', Width);
    Ini.WriteInteger('Window', 'Height', Height);
  end;  // If maximized, the last recorded wsNormal values will be saved.

It's late for me, so If I'm totally off the subject then excuse me :)  but, it may give you something to think about anyway.

fibdev
"A good manager leads by example... When that fails, brute intimidation works pretty well too."


 
0

Featured Post

Independent Software Vendors: 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

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…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

734 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