Solved

Minimize button does not minimize a form

Posted on 2003-11-06
6
411 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Newbie Thread Programming 1 117
Simple Delphi Question 9 77
QRReport  TQrmemo vertical stretching 1 37
SUM 2 INTEGER ARRAYS INTO 1 10 58
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

705 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

20 Experts available now in Live!

Get 1:1 Help Now