Solved

How to make form modal

Posted on 2002-04-17
6
383 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now