Board index » delphi » Message Queries

Message Queries


2003-09-03 01:05:03 AM
delphi18
Greeting's All,
Could anyone tell if it is possible to initialise a message dialog before
the application creates the form. And possibly only create the form after
the user has clicked "ok"
Could you also explain how i should go about setting this.
Delphi Newbie
J-M
 
 

Re:Message Queries

"Jean-Michel" <XXXX@XXXXX.COM>writes
Quote
Greeting's All,

Could anyone tell if it is possible to initialise a message dialog before
the application creates the form. And possibly only create the form after
the user has clicked "ok"
Could you also explain how i should go about setting this.
The most often used way, AFAIK, is to create a separate form with an OK
button on it for you dialog. In the project file (DPR unit), just after
creating the main form, but before showing it or issuing the Application.Run
command, create and show the dialog form. Then, the project should continue
on normally.
--
Woody (TMW)
Freeware Page: users.eonet.net/woodytmw
Success always occurs in private, and failure in full view.
 

Re:Message Queries

But that requires a form for it. isn't there a way just code a messagedlg
function, that runs before the main form. cause otherwise I will just set it
in the formcreate procedure.
J-M
"Woody (TMW)" <XXXX@XXXXX.COM>writes
Quote
"Jean-Michel" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...
>Greeting's All,
>
>Could anyone tell if it is possible to initialise a message dialog
before
>the application creates the form. And possibly only create the form
after
>the user has clicked "ok"
>Could you also explain how i should go about setting this.

The most often used way, AFAIK, is to create a separate form with an OK
button on it for you dialog. In the project file (DPR unit), just after
creating the main form, but before showing it or issuing the
Application.Run
command, create and show the dialog form. Then, the project should
continue
on normally.

--
Woody (TMW)
Freeware Page: users.eonet.net/woodytmw

Success always occurs in private, and failure in full view.


 

Re:Message Queries

"Jean-Michel" <XXXX@XXXXX.COM>writes
Quote
But that requires a form for it. isn't there a way just code a messagedlg
function, that runs before the main form. cause otherwise I will just set it
in the formcreate procedure.

If all you want to do is display a simple message, then you can show a
dialog using ShowMessage or anything else. Creating your own form is useful
for more involved information to be displayed but you don't have to do it
that way.
--
Woody (TMW)
Freeware Page: users.eonet.net/woodytmw
Success always occurs in private, and failure in full view.
 

Re:Message Queries

Jean-Michel writes:
Quote

Could anyone tell if it is possible to initialise a message dialog
before the application creates the form. And possibly only create the
form after the user has clicked "ok"
Could you also explain how i should go about setting this.
You can create and display forms without (before) the application object is
created or run. Example:
(this would be your project source file - Project | View Source)
begin
// or used canned dialogs
if MessageDlg('Do you really want to run?', mtConfirmation, [mbYes, mbNo],
0) <>mrYes then
Halt;
// or use your own
with TMySpecialDialog.Create(nil) do
begin
try
if ShowModal <>mrOK then
Halt;
finally
Free;
end;
end;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: www.logicfundamentals.com/RADBooks.html
"It is error alone which needs the support of government. Truth can
stand by itself." - Thomas Jefferson
 

Re:Message Queries

Ahh. Yeas thank you. Will try that.
Thanks a lot
J-M
"Wayne Niddery [TeamB]" <XXXX@XXXXX.COM>writes
Quote
Jean-Michel writes:
>
>Could anyone tell if it is possible to initialise a message dialog
>before the application creates the form. And possibly only create the
>form after the user has clicked "ok"
>Could you also explain how i should go about setting this.

You can create and display forms without (before) the application object
is
created or run. Example:

(this would be your project source file - Project | View Source)

begin
// or used canned dialogs

if MessageDlg('Do you really want to run?', mtConfirmation, [mbYes,
mbNo],
0) <>mrYes then
Halt;

// or use your own

with TMySpecialDialog.Create(nil) do
begin
try
if ShowModal <>mrOK then
Halt;
finally
Free;
end;
end;

Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.


--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: www.logicfundamentals.com/RADBooks.html
"It is error alone which needs the support of government. Truth can
stand by itself." - Thomas Jefferson