Solved

How to make form modal

Posted on 2002-04-17
6
403 Views
Last Modified: 2010-04-04

How can I make a Delphi form modal, so the "underlaying" form(s) is/are blocked....

Alk
0
Comment
Question by:roczalk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 11

Accepted Solution

by:
robert_marquardt earned 50 total points
ID: 6947434
Somewhere you call Form.Show. Replace by Form.ShowModal.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6947445
yep, thats it
0
 
LVL 3

Expert Comment

by:VSF
ID: 6947448
if your form is not created automatically at runtime just do:

Procedure TForm1.Button1Click(Sender: TObject);
begin
 application.createform(TForm2, Form2);
 Form2.Showmodal;
end;

It is important to remember that modal forms can not be MDiChild and they will stay on top until you call the form's OnCloseEvent:

Action:=CaFree;


Hope it helps!
VSF
www.victory.hpg.com.br
www.boatoda.hpg.com.br
0
Technology Partners: 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!

 
LVL 27

Expert Comment

by:kretzschmar
ID: 6947471
hmm,

i usual use something like this

begin
  with tFormWhichShouldBeShowedModal.create(self) do
  try
    showmodal;  
    //or if modalresult is needed
    //mres := showmodal;
    //
    //maybe transport some values from the form
    //for further process
    somevar := EditControlOnModalForm.text;
  finally
    release;
  end;
end;
   
meikl ;-)
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 6947764
Do not call CreateForm. Create is good enough.
0
 

Author Comment

by:roczalk
ID: 6948288
Thanks all for the response.
I did indeed find the ShowModal, but was surprised I couldn't place this setting on the form properties itself.

As Robert was the first with th esolution, I'll reward him with the points, but I'm also gratefull for the other comments. Thanks guy's ;-)

Alk
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 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