Solved

How to make form modal

Posted on 2002-04-17
6
399 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
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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

822 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