?
Solved

How to display a message before other component display it own message ?

Posted on 2003-10-28
8
Medium Priority
?
189 Views
Last Modified: 2010-04-05
I have 3 components, if I add it to a form, it always display each own message when open the application before display my own message, how can i add a message before other components display it own message ?

example I try to add like this

  showmessage('I'm the 1st Message');
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;

but still cannot display my message first before other messages.
Anyone can help me in this problem ? Thanks.
0
Comment
Question by:matrixworld
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9633052
?? what for a message
0
 
LVL 10

Expert Comment

by:kacor
ID: 9633250
- which components you have?
- are connected special messages to this components?
wbr Janos
0
 
LVL 10

Expert Comment

by:kacor
ID: 9633349
I made for you a simple demoproject:
There are 3 Buttons on Form1 having each of them fast the same message:

procedure TForm1.Button1Click(Sender: TObject);
begin
   showmessage('I am the Button1');
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
   showmessage('I am the Button2');
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
   showmessage('I am the Button3');
end;

And they appear after pressing the buttons.
But I created the first message too connected to the On Create event of the form which appears before creating the form1:

procedure TForm1.FormCreate(Sender: TObject);
begin
   showmessage('I am the 1st message');
end;

Otherwise your statement
        showmessage('I'm the 1st Message');
is wrong because you have to doble the ' character:
        showmessage('I''m the 1st Message');

I hope I could help

wbr
Janos
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 17

Accepted Solution

by:
geobul earned 120 total points
ID: 9633815
Hi,

Add this at the end of your main form:

initialization
  showmessage('I''m the 1st Message');

end.

Regards, Geo
0
 

Author Comment

by:matrixworld
ID: 9638458
Hi Geo,
   your method is working unless I create a component with initialization and then place it before other components under uses call, is that any possible to do it before the uses call ? Thanks & Regards.
0
 
LVL 17

Expert Comment

by:geobul
ID: 9640029
Hi,

Make a new unit with the code above only and add that unit on the first place in main form's uses clause.

Regards, Geo
0
 
LVL 1

Expert Comment

by:ttd
ID: 9640329
Hi,

Try to debug your application from the very first step by pressing F7 in the IDE, you will learn how units will be initialized, which order components are created in, and so on. You will found the right place to put your message. Very simple, isn't it?

Regards,

ttd
0
 

Author Comment

by:matrixworld
ID: 9648785
Hi Geo,

   How can I set a variable under initialization example like below

initialization
  sTest := 'This is testing';
  showmessage('I''m the 1st Message');


Thanks & Regards,
Peter Oh
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Screencast - Getting to Know the Pipeline
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month16 days, 4 hours left to enroll

850 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