?
Solved

Smoothly Minimize

Posted on 1998-06-18
8
Medium Priority
?
340 Views
Last Modified: 2010-04-03
Does anyone know, why (correct me if i'm wrong) Delphi Apps do not minimize smoothly, like other windows application?
Does it have to do with the use of either VBL or MFC?
Is there anything I can do?
0
Comment
Question by:kyr
8 Comments
 
LVL 3

Expert Comment

by:altena
ID: 1353677
The (real) main window is hidden in a delphi application. That explains what you are seeing.

If this is a real big problem: Buy a copy of Petzold's book
and start at winmain(). Then you have full control.
0
 
LVL 3

Expert Comment

by:vladika
ID: 1353678
See
procedure TApplication.Minimize;
begin
  if not IsIconic(FHandle) then
  begin
    NormalizeTopMosts;
    SetActiveWindow(FHandle);
    ShowWinNoAnimate(FHandle, SW_MINIMIZE);  !!!!!!!!!!!!  <- THIS IS CAUSE OF TROUBLE
    if Assigned(FOnMinimize) then FOnMinimize(Self);
  end;
end;


0
 

Author Comment

by:kyr
ID: 1353679
Bying a book to get a single tip makes experts-exchange useless.
A am not interested in learning all the low level work needed to create a form.

I am just asking for some lines of code that will do this for me.
0
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!

 

Author Comment

by:kyr
ID: 1353680
Thanks very much for your efford anyway.
I will have in mind the book for the future.

0
 

Author Comment

by:kyr
ID: 1353681
vladika,
Do you mean that all we have to do is to replace the default minimize routine with a custom one?
If you know details I would appreciate an answer.

kyriacos
0
 
LVL 2

Expert Comment

by:kjteng
ID: 1353682
hi
0
 
LVL 3

Accepted Solution

by:
vladika earned 480 total points
ID: 1353683
I think Altena is right.
The problem is The main window is hidden.

Maybe It's not good solution, but ...

Copy forms.pas into your project directory and
modify TApplication.Minimize;

procedure TApplication.Minimize;
var SaveRect, MainRect: TRect;
begin
  if not IsIconic(FHandle) then
  begin
    NormalizeTopMosts;
    SetActiveWindow(FHandle);
    if MainForm <> nil then
    begin
      GetWindowRect(FHandle, SaveRect);
      GetWindowRect(MainForm.Handle, MainRect);
      SetWindowPos(FHandle, 0, MainRect.Left, MainRect.Top, MainRect.Right-MainRect.Left, MainRect.Bottom-MainRect.Top, 0);
      ShowWindow(FHandle, SW_MINIMIZE);
      SetWindowPos(FHandle, 0, SaveRect.Left, SaveRect.Top, SaveRect.Right-SaveRect.Left, SaveRect.Bottom-SaveRect.Top, 0);
    end else
      ShowWinNoAnimate(FHandle, SW_MINIMIZE);
    if Assigned(FOnMinimize) then FOnMinimize(Self);
  end;
end;


0
 

Author Comment

by:kyr
ID: 1353684
thanx
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

850 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