Solved

Minimize button does not minimize a form

Posted on 2003-11-06
6
412 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
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.

 
LVL 33

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

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 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

14 Experts available now in Live!

Get 1:1 Help Now