Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to minimize an application when modal forms are present Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
28-Oct-02
Category
VCL-Forms
Language
Delphi 2.x
Views
106
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

My application (non MDI) has many modal forms which are open most of the time. When 
the user wants to minimize the application and presses the minimize system button, 
he experiences only the top modal form gets minimized while the other forms (at 
least app's main form) are still at their current size. Moreover, the user now is 
confused because clicking on the main form does nothing but giving errors to him. I 
can not change the application's appearance or exchange the modal forms to some 
other solution. Is there a way I can keep my modal design and still enable users to 
minimize the application the way they are used to?

Answer:

Add a handler for WM_SYSCOMMAND to your modal forms. The handler should look like 
this:

1   private {form declaration}
2   
3   procedure WMSyscommand(var msg: TWmSysCommand); message WM_SYSCOMMAND;
4   
5   procedure TForm2.WMSyscommand(var msg: TWmSysCommand);
6   begin
7     case (msg.cmdtype and $FFF0) of
8       SC_MINIMIZE:
9         begin
10          msg.result := 0;
11          EnableWindow(Application.handle, true);
12          Application.Minimize;
13        end;
14    else
15      inherited;
16    end;
17  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC