Solved

Minimize button does not minimize a form

Posted on 2003-11-06
6
414 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
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 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