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 disable the main form while a dialog box is shown 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
Dialogs
Language
Delphi 2.x
Views
127
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

I'm trying to set up a "Please Wait" box. I want it to be modal in the sense that 
my main form is deactivated while I have this box showing. But, in the function 
that displays the "Please Wait" box, I want the code to continue rather than stall, 
waiting for the box to close.

Answer:

1   { ... }
2   WaitBox.Show; {shows your WaitBox}
3   Enabled := false; {disables the whole main form (Self.Enabled)}
4   Application.ProcessMessages; {let the two forms update themselves}
5   try
6     { ... Do next steps }
7   finally
8     Enabled := true;
9     WaitBox.Hide;
10  end;


Note that the WaitBox must be visible before you can disable the main form. You 
needn't disable each single component. With this construction you can easily add a 
Cancel-Button to your WaitBox. Set a public property (CancelPressed) to TRUE if the 
Cancel Button is pressed and you can do something like this:

11  { ... }
12  repeat
13    { next steps }
14    Application.ProcessMessages;
15  until
16  WaitBox.CancelPressed
17  { ... }


			
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