Solved

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

Posted on 2003-10-28
8
186 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
[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
  • 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
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 17

Accepted Solution

by:
geobul earned 30 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

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

687 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