I have problem with pop-up screen. The code can be compile and run but when the pop-up screen appear, I can't close the pop-up screen. I have to click a lot of times on the OK button.
Here is the code:

i:Integer;
begin
for i := 0 to 4 do
begin
  sleep(4000); //stops for 4000 milliseconds
  if i = 4 then
  showMessage('Please get up and relax your eyes');
  end;

May I know what is the problem with the code? Thank you.

I don't find any mistake in your code ....
It works fine compiled by Delphi 7, no problems at all ....

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  I:      Integer;
begin
  for I := 0 to 4 do
  begin
    Sleep(4000); //stops for 4000 milliseconds
    if (I = 4) then
      ShowMessage('Please get up and relax your eyes');
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Sleep(20000); //stops for 20000 milliseconds
  ShowMessage('Please get up and relax your eyes');
end;

end.

I know that it works well but then when I want to close the pop-up screen, I have to click a lot of times on the OK button then the pop-up screen will disappear.

I know that it works well but then when I want to close the pop-up screen, I have to click a lot of times on the OK button then the pop-up screen will disappear.

raud10 sorry,
I think, you did not understand me ....
Code that you posted above could not be reason for showing more than 1 Message 'Please get up and relax your eyes', so above code is correct ....
May be you call above correct code more than once, but from another part of your program, that we could not see, because it is not posted above ....
So my opinion is: the reason of many popup Messages is outside above code. Onother part of your program calls many tinmes the above code, and causes showing of many Messages.

Ok. I will post u the entire code.

procedure TForm1.Timer1Timer(Sender: TObject);
var verbrauch,TEGenergy:real;
i:Integer;
begin
   for i := 0 to 4 do
   begin
   sleep (1000);
   if i = 4 then
   showMessage('Please get up and relax your eyes');
   end;
   Timer1.enabled := true;
if form2.visible=false then checkbox5.Checked :=false;

if (now-ankunftnode1)<0.0001 then pagecontrol1.Pages[0].Highlighted:=true
  else pagecontrol1.Pages[0].Highlighted:=false;
if (now-ankunftnode2)<0.0001 then pagecontrol1.Pages[1].Highlighted:=true
  else pagecontrol1.Pages[1].Highlighted:=false;
if (now-ankunftnode3)<0.0001 then pagecontrol1.Pages[2].Highlighted:=true
  else pagecontrol1.Pages[2].Highlighted:=false;
if (now-ankunftnode4)<0.0001 then pagecontrol1.Pages[3].Highlighted:=true
  else pagecontrol1.Pages[3].Highlighted:=false;

if now-ankunft>0.0001 then
  begin
  edit2.Text:='0';
  edit3.Text:='0';
  edit5.Text:='0';
  edit7.Text:='0';
  edit9.Text:='0';
  edit10.Text:='0';
  edit11.Text:='0';
  label1.Visible:=false;
  label2.Visible:=false;
  label3.Visible:=false;
  label4.Visible:=false;
  image2.Visible:=false;
  progbar1.Visible:=false;
  end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
   verbrauch,TEGenergy:      real;
   i:                        Integer;
begin
  Timer1.enabled := False; { Avoids multiple popups of the Message }
  for i := 0 to 4 do
  begin
    sleep (1000);
    if i = 4 then
      showMessage('Please get up and relax your eyes');
  end;

  if form2.visible=false then
    checkbox5.Checked := false;

  if (now-ankunftnode1)<0.0001 then
    pagecontrol1.Pages[0].Highlighted := true
  else
    pagecontrol1.Pages[0].Highlighted := false;

  if (now-ankunftnode2)<0.0001 then
    pagecontrol1.Pages[1].Highlighted := true
  else
    pagecontrol1.Pages[1].Highlighted := false;

  if (now-ankunftnode3)<0.0001 then
    pagecontrol1.Pages[2].Highlighted := true
  else
    pagecontrol1.Pages[2].Highlighted := false;

  if (now-ankunftnode4)<0.0001 then
    pagecontrol1.Pages[3].Highlighted := true
  else
    pagecontrol1.Pages[3].Highlighted := false;

  if now-ankunft>0.0001 then
  begin
    edit2.Text:='0';
    edit3.Text:='0';
    edit5.Text:='0';
    edit7.Text:='0';
    edit9.Text:='0';
    edit10.Text:='0';
    edit11.Text:='0';
    label1.Visible := false;
    label2.Visible := false;
    label3.Visible := false;
    label4.Visible := false;
    image2.Visible := false;
    progbar1.Visible := false;
  end;
end;

The reason for popup-Messages is that Timer activates ( every 1000 ms probably ), and calls the procedure TForm1.Timer1Timer(); a count of times before delaying from 5000 ms to expire ....
So I did deactivate the Timer by:
Timer1.Enabled := False; { no active Timer = no multiple popups of the Message }

procedure TForm1.Timer1Timer(Sender: TObject);
var
   verbrauch,TEGenergy:      real;
   i:                        Integer;
begin
  Timer1.enabled := False; { Avoids multiple popups of the Message }
  for i := 0 to 4 do
  begin
    sleep (1000);
    if i = 4 then
      showMessage('Please get up and relax your eyes');
  end;

  if form2.visible=false then
    checkbox5.Checked := false;

  if (now-ankunftnode1)<0.0001 then
    pagecontrol1.Pages[0].Highlighted := true
  else
    pagecontrol1.Pages[0].Highlighted := false;

  if (now-ankunftnode2)<0.0001 then
    pagecontrol1.Pages[1].Highlighted := true
  else
    pagecontrol1.Pages[1].Highlighted := false;

  if (now-ankunftnode3)<0.0001 then
    pagecontrol1.Pages[2].Highlighted := true
  else
    pagecontrol1.Pages[2].Highlighted := false;

  if (now-ankunftnode4)<0.0001 then
    pagecontrol1.Pages[3].Highlighted := true
  else
    pagecontrol1.Pages[3].Highlighted := false;

  if now-ankunft>0.0001 then
  begin
    edit2.Text:='0';
    edit3.Text:='0';
    edit5.Text:='0';
    edit7.Text:='0';
    edit9.Text:='0';
    edit10.Text:='0';
    edit11.Text:='0';
    label1.Visible := false;
    label2.Visible := false;
    label3.Visible := false;
    label4.Visible := false;
    image2.Visible := false;
    progbar1.Visible := false;
  end;
end;

So for

Timer1.enabled := False; { Avoids multiple popups of the Message }

u have given me, the pop-up will eventually pop-up again after I press OK button right?

So for

Timer1.enabled := False; { Avoids multiple popups of the Message }

u have given me, the pop-up will eventually pop-up again after I press OK button right?

Not exactly ....
It is very complicated case .... because some properties of your project are not known for us who read your code ....
For example the Property Interval of the TTimer Component by default is 1000 ms, but you may have changed it ....
Let I think the Property Interval is 1000 ms, so your TTimer Component will activate its 'method Timer1Timer(Sender: TObject); automatically on every 1000 ms, but at first activation your code has to delay 5000 ms before to Shows first popup-Message, so before first popup-Message the method will be called 5 or 6 times ....
Your reaction to see the popup-Message needs some time, after that your reaction with mouse needs some time, so it gives the programm some time to show more than one popup-Messages ....
So after first activation of the method Timer1Timer(Sender: TObject); I did stop it by deactivation the TTimer Component:
Timer1.enabled := False; { Avoids multiple popups of the Message }, but this is only to cause some brain-activity about the reason of your problem, I have no Idea, why you need this TTimer Component .... May be my idea to deactivate TTimer Component is not good at all ???? You have a problem with the popup-Messages - may be you don't need popup-Messages, may be it is a better idea to use a TMemo Component instead of popups ????
Here is my suggestion code you may use if you decide:

procedure TForm1.Timer1Timer(Sender: TObject);
var
   verbrauch,TEGenergy:      real;
   I:                        Integer;
   N:                        Integer;
begin
  for I := 0 to 4 do
  begin
    N := (I+1)*128;
    ProgressBar1.Position := N;
    Memo1.Lines.Add(DateTimeToStr(Now)+'.... = .... '+IntToStr(N));
    Sleep (1000);
  end;

  if form2.visible=false then
    checkbox5.Checked := false;

  if (now-ankunftnode1)<0.0001 then
    pagecontrol1.Pages[0].Highlighted := true
  else
    pagecontrol1.Pages[0].Highlighted := false;

  if (now-ankunftnode2)<0.0001 then
    pagecontrol1.Pages[1].Highlighted := true
  else
    pagecontrol1.Pages[1].Highlighted := false;

  if (now-ankunftnode3)<0.0001 then
    pagecontrol1.Pages[2].Highlighted := true
  else
    pagecontrol1.Pages[2].Highlighted := false;

  if (now-ankunftnode4)<0.0001 then
    pagecontrol1.Pages[3].Highlighted := true
  else
    pagecontrol1.Pages[3].Highlighted := false;

  if now-ankunft>0.0001 then
  begin
    edit2.Text:='0';
    edit3.Text:='0';
    edit5.Text:='0';
    edit7.Text:='0';
    edit9.Text:='0';
    edit10.Text:='0';
    edit11.Text:='0';
    label1.Visible := false;
    label2.Visible := false;
    label3.Visible := false;
    label4.Visible := false;
    image2.Visible := false;
    progbar1.Visible := false;
  end;
end;

I don't really understand what is it u were saying. It's making me confused... Can u explain it more details for the code u have just given as a suggestion?

I: Integer;   
N: Integer;
begin  
for I := 0 to 4 do  
begin    N := (I+1)*128;    
ProgressBar1.Position := N;    
Memo1.Lines.Add(DateTimeToStr(Now)+'.... = .... '+IntToStr(N));    
Sleep (1000);  
end;

I don't really understand what is it u were saying. It's making me confused... Can u explain it more details for the code u have just given as a suggestion?

I: Integer;   
N: Integer;
begin  
  for I := 0 to 4 do 
  begin    
    N := (I+1)*128;    
    ProgressBar1.Position := N;    
     Memo1.Lines.Add(DateTimeToStr(Now)+'.... = .... '+IntToStr(I));    
     Sleep (1000);  
end;

Above code works with non-stop active TTimer Component, because there is not my first suggestion:
Timer1.enabled := False; { Stops Timer1's activity }
I have in my example a ProgressBar1 Component. It's Property Max is set to 640, and Property Min is set to 1. The ProgressBar Component will show you non-stop working the loop of 5 steps:

for I := 0 to 4 do 
  begin
    //.....
  end;

I have in my example a Memo1 Component, it is there to avoid using popup-Messages. Inside this Memo1 Component will be shown every step of the loop

for I := 0 to 4 do 
  begin
    //.....
  end;

but it will show What is the current time and what is the number of variable I.
Taht's all = two Components to show you how the loop works non-stop.
To stop Timer1 Component you will need may be to press a new button in your form:

procedure TForm1.Button3Click(Sender: TObject);
begin
  Timer1.Enabled := False;
end;

Now the program is working but there's one problem. When I run the program, I can't click any other button like the setting button or the run button. It's like the whole program freeze. What should I do?

procedure TForm1.Timer1Timer(Sender: TObject);
var verbrauch,TEGenergy:real;
i:Integer;
begin
   Timer1.enabled := false;
   for i := 0 to 5 do
  begin
    sleep (1000);
    if i = 5 then
      showMessage('Please get up and relax your eyes');
  end;
  Timer1.enabled := true;

if form2.visible=false then checkbox5.Checked :=false;

if (now-ankunftnode1)<0.0001 then pagecontrol1.Pages[0].Highlighted:=true
  else pagecontrol1.Pages[0].Highlighted:=false;
if (now-ankunftnode2)<0.0001 then pagecontrol1.Pages[1].Highlighted:=true
  else pagecontrol1.Pages[1].Highlighted:=false;
if (now-ankunftnode3)<0.0001 then pagecontrol1.Pages[2].Highlighted:=true
  else pagecontrol1.Pages[2].Highlighted:=false;
if (now-ankunftnode4)<0.0001 then pagecontrol1.Pages[3].Highlighted:=true
  else pagecontrol1.Pages[3].Highlighted:=false;

if now-ankunft>0.0001 then
  begin
  edit2.Text:='0';
  edit3.Text:='0';
  edit5.Text:='0';
  edit7.Text:='0';
  edit9.Text:='0';
  edit10.Text:='0';
  edit11.Text:='0';
  label1.Visible:=false;
  label2.Visible:=false;
  label3.Visible:=false;
  label4.Visible:=false;
  image2.Visible:=false;
  progbar1.Visible:=false;
  end;

Now the program is working but there's one problem. When I run the program, I can't click any other button like the setting button or the run button. It's like the whole program freeze. What should I do?

Your program does not exactly freeze ....
Your program does non-stop sleep :)

//  It is your decision to have so much:
  for i := 0 to 5 do
  begin
    sleep (1000);
    if i = 5 then
      showMessage('Please get up and relax your eyes');
  end;
//  Your program sleeps, because of your order :icon_exclaim:

Your program does not exactly freeze ....
Your program does non-stop sleep :)

//  It is your decision to have so much:
  for i := 0 to 5 do
  begin
    sleep (1000);
    if i = 5 then
      showMessage('Please get up and relax your eyes');
  end;
//  Your program sleeps, because of your order :icon_exclaim:

So I shouldn't put sleep statement? But I try to remove the sleep statment but then the pop-up screen keeping appearing every second and as for the other buttons, it can work but still the pop-up screen keep appearing. What should I do?

So I shouldn't put sleep statement?

I think you don't need the sleep statement - this is only my opinion ....
If you need 5 seconds interval, you can reach it changing the Property of the Timer1 Component Intreval := 5000 ms

Can I put this code:

Timer1.Interval := 10000;

Because I can't open up the property side to change the interval. Will this works?

Can I put this code:

Timer1.Interval := 10000;

Because I can't open up the property side to change the interval. Will this works?

You may change the property Interval at design-time

You may put this code ofcourse:

Timer1.Interval := 10000;

Now I don't want to put under TTimer column.

procedure TForm1.ComPortOpen(Sender: TObject);
begin
  Button_Open.Caption := 'Stop';
end;

procedure TForm1.ComPortClose(Sender: TObject);
begin
  if Button_Open <> nil then
    Button_Open.Caption := 'Run';
end;

procedure TForm1.ComPortRxChar(Sender: TObject; Count: Integer);
var
  Str,temp, ZW_WAR: String;
  DateTime : TDateTime;
  b,Nodeadresse:byte;
  dbm, D751, HeatSink, HeatFlux,thot,tcold,DT,TEGV,Ubat,Pout,rssi,energybalance :double;
  a:byte;
  dummy:integer;
  letzte:longint;
begin
  //get actual data and store it in "str"
  ComPort.ReadStr(Str, Count);
  //store every char from str in "rawdata" until cr + lf
  for a := 1 to length(str) do begin
    inc(laenge);
    rawdata[laenge]:=ord(str[a]);
    if (rawdata[laenge]=10) and (rawdata[laenge-1]= 13)then begin
      // if received protocol have the defined length of 11 then it is the right one
      if laenge=11 then begin
         //give rawdate from "rawdata" to "rawdata2" and clear rawdata
         for dummy:=1 to 11 do begin rawdata2[dummy]:=rawdata[dummy];rawdata[dummy]:=0;end;
         edit6.Text:='';
         for dummy:= 1 to 11 do edit6.Text:=edit6.Text+inttostr(rawdata2[dummy])+' ';
         nodeadresse:=ord(rawdata2[1]);
         //check if the address of the actual TE-Power-NODE already exists or not
         if nodeadressen[1]=0 then begin nodeadressen[1]:=nodeadresse;pagecontrol1.Pages[0].Caption:='NODE '+inttostr(nodeadresse);end;
         node:=99;
         for dummy:=1 to nodeanzahl do
             if nodeadressen[dummy]=nodeadresse then node:=dummy;
             if node = 99 then if nodeanzahl<5 then begin
                inc(nodeanzahl);nodeadressen[nodeanzahl]:=nodeadresse;node:=nodeanzahl;
                pagecontrol1.Pages[nodeanzahl-1].Caption:='NODE '+inttostr(nodeadresse);pagecontrol1.Pages[nodeanzahl-1].TabVisible:=true;
             end;

In these three procedure, where can I put the counter to run the pop-up screen. What I want now is once I click the RUN button, after sometime the pop-up screen will appear. How to put it in code?

var
    SMsg:     string;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Timer1.Enabled := False;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Timer1.Enabled := False;
  ShowMessage(SMsg);
end;

procedure TForm1.PopUpMsg(I: Integer;  S: string);
begin
  SMsg := S;
  Timer1.Interval := I;
  Timer1.Enabled := True;
end;

procedure TForm1.ComPortOpen(Sender: TObject);
begin
  Button_Open.Caption := 'Stop';
  PopUpMsg(8000,  'Com Port is Open');
end;

procedure TForm1.ComPortClose(Sender: TObject);
begin
  if Button_Open <> nil then
    Button_Open.Caption := 'Run';
  PopUpMsg(10000,  'Com Port is Closed');
end;

procedure TForm1.ComPortRxChar(Sender: TObject; Count: Integer);
var
  Str,temp, ZW_WAR: String;
  DateTime : TDateTime;
  b,Nodeadresse:byte;
  dbm, D751, HeatSink, HeatFlux,thot,tcold,DT,TEGV,Ubat,Pout,rssi,energybalance :double;
  a:byte;
  dummy:integer;
  letzte:longint;
begin
  //get actual data and store it in "str"
  ComPort.ReadStr(Str, Count);
  //store every char from str in "rawdata" until cr + lf
  for a := 1 to length(str) do begin
    inc(laenge);
    rawdata[laenge]:=ord(str[a]);
    if (rawdata[laenge]=10) and (rawdata[laenge-1]= 13)then begin
      // if received protocol have the defined length of 11 then it is the right one
      if laenge=11 then begin
         //give rawdate from "rawdata" to "rawdata2" and clear rawdata
         for dummy:=1 to 11 do begin rawdata2[dummy]:=rawdata[dummy];rawdata[dummy]:=0;end;
         edit6.Text:='';
         for dummy:= 1 to 11 do edit6.Text:=edit6.Text+inttostr(rawdata2[dummy])+' ';
         nodeadresse:=ord(rawdata2[1]);
         //check if the address of the actual TE-Power-NODE already exists or not
         if nodeadressen[1]=0 then begin nodeadressen[1]:=nodeadresse;pagecontrol1.Pages[0].Caption:='NODE '+inttostr(nodeadresse);end;
         node:=99;
         for dummy:=1 to nodeanzahl do
             if nodeadressen[dummy]=nodeadresse then node:=dummy;
             if node = 99 then if nodeanzahl<5 then begin
                inc(nodeanzahl);nodeadressen[nodeanzahl]:=nodeadresse;node:=nodeanzahl;
                pagecontrol1.Pages[nodeanzahl-1].Caption:='NODE '+inttostr(nodeadresse);pagecontrol1.Pages[nodeanzahl-1].TabVisible:=true;
  PopUpMsg(5000,  'Get Up and relax your eyes');
end;

For these three codes, I can just declare is it?

procedure TForm1.FormCreate(Sender: TObject);
begin  
Timer1.Enabled := False;
end; 
procedure TForm1.Timer1Timer(Sender: TObject);
begin  
Timer1.Enabled := False;  
ShowMessage(SMsg);
end; 
procedure TForm1.PopUpMsg(I: Integer;  S: string);
begin  
SMsg := S;  
Timer1.Interval := I;  
Timer1.Enabled := True;
end;
var
    SMsg:     string;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Timer1.Enabled := False;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Timer1.Enabled := False;
  ShowMessage(SMsg);
end;

procedure TForm1.PopUpMsg(I: Integer;  S: string);
begin
  SMsg := S;
  Timer1.Interval := I;
  Timer1.Enabled := True;
end;

procedure TForm1.ComPortOpen(Sender: TObject);
begin
  Button_Open.Caption := 'Stop';
  PopUpMsg(8000,  'Com Port is Open');
end;

procedure TForm1.ComPortClose(Sender: TObject);
begin
  if Button_Open <> nil then
    Button_Open.Caption := 'Run';
  PopUpMsg(10000,  'Com Port is Closed');
end;

procedure TForm1.ComPortRxChar(Sender: TObject; Count: Integer);
var
  Str,temp, ZW_WAR: String;
  DateTime : TDateTime;
  b,Nodeadresse:byte;
  dbm, D751, HeatSink, HeatFlux,thot,tcold,DT,TEGV,Ubat,Pout,rssi,energybalance :double;
  a:byte;
  dummy:integer;
  letzte:longint;
begin
  //get actual data and store it in "str"
  ComPort.ReadStr(Str, Count);
  //store every char from str in "rawdata" until cr + lf
  for a := 1 to length(str) do begin
    inc(laenge);
    rawdata[laenge]:=ord(str[a]);
    if (rawdata[laenge]=10) and (rawdata[laenge-1]= 13)then begin
      // if received protocol have the defined length of 11 then it is the right one
      if laenge=11 then begin
         //give rawdate from "rawdata" to "rawdata2" and clear rawdata
         for dummy:=1 to 11 do begin rawdata2[dummy]:=rawdata[dummy];rawdata[dummy]:=0;end;
         edit6.Text:='';
         for dummy:= 1 to 11 do edit6.Text:=edit6.Text+inttostr(rawdata2[dummy])+' ';
         nodeadresse:=ord(rawdata2[1]);
         //check if the address of the actual TE-Power-NODE already exists or not
         if nodeadressen[1]=0 then begin nodeadressen[1]:=nodeadresse;pagecontrol1.Pages[0].Caption:='NODE '+inttostr(nodeadresse);end;
         node:=99;
         for dummy:=1 to nodeanzahl do
             if nodeadressen[dummy]=nodeadresse then node:=dummy;
             if node = 99 then if nodeanzahl<5 then begin
                inc(nodeanzahl);nodeadressen[nodeanzahl]:=nodeadresse;node:=nodeanzahl;
                pagecontrol1.Pages[nodeanzahl-1].Caption:='NODE '+inttostr(nodeadresse);pagecontrol1.Pages[nodeanzahl-1].TabVisible:=true;
  PopUpMsg(5000,  'Get Up and relax your eyes');
end;

I try to put in all the code that were given to my program but when I run it, there's a lot of errors. What can I do???

To avoid errors, you must to declare these in the public section of TForm1:

// type
  // TForm1 = class(TForm)
  // ........
  public
    SMsg:     string;
    procedure PopUpMsg(I: Integer;  S: string);
    { Public declarations } 
  // ........

To avoid errors, you must to declare these in the public section of TForm1:

// type
  // TForm1 = class(TForm)
  // ........
  public
    SMsg:     string;
    procedure PopUpMsg(I: Integer;  S: string);
    { Public declarations } 
  // ........

Can I use this code instead?

procedure TForm1.ComPortRxChar(Sender: TObject; Count: Integer);
var
  Str,temp, ZW_WAR: String;
  DateTime : TDateTime;
  b,Nodeadresse:byte;
  dbm, D751, HeatSink, HeatFlux,thot,tcold,DT,TEGV,Ubat,Pout,rssi,energybalance :double;
  a:byte;
  dummy:integer;
  letzte:longint;
  i:Integer;
begin
    Timer1.enabled := false;
   for i := 0 to 5 do
  begin
    Timer1.Interval := 10000;
    if i = 5 then
      showMessage('Please get up and relax your eyes');
  end;
  Timer1.enabled := true;
  //get actual data and store it in "str"
  ComPort.ReadStr(Str, Count);
  //store every char from str in "rawdata" until cr + lf
  for a := 1 to length(str) do begin
    inc(laenge);
    rawdata[laenge]:=ord(str[a]);
    if (rawdata[laenge]=10) and (rawdata[laenge-1]= 13)then begin
      // if received protocol have the defined length of 11 then it is the right one
      if laenge=11 then begin
         //give rawdate from "rawdata" to "rawdata2" and clear rawdata
         for dummy:=1 to 11 do begin rawdata2[dummy]:=rawdata[dummy];rawdata[dummy]:=0;end;
         edit6.Text:='';
         for dummy:= 1 to 11 do edit6.Text:=edit6.Text+inttostr(rawdata2[dummy])+' ';
         nodeadresse:=ord(rawdata2[1]);
         //check if the address of the actual TE-Power-NODE already exists or not
         if nodeadressen[1]=0 then begin nodeadressen[1]:=nodeadresse;pagecontrol1.Pages[0].Caption:='NODE '+inttostr(nodeadresse);end;
         node:=99;
         for dummy:=1 to nodeanzahl do
             if nodeadressen[dummy]=nodeadresse then node:=dummy;
             if node = 99 then if nodeanzahl<5 then begin
                inc(nodeanzahl);nodeadressen[nodeanzahl]:=nodeadresse;node:=nodeanzahl;
                pagecontrol1.Pages[nodeanzahl-1].Caption:='NODE '+inttostr(nodeadresse);pagecontrol1.Pages[nodeanzahl-1].TabVisible:=true;
             end;

You may use the following:

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Timer1.Enabled := False;
  ShowMessage(SMsg);
end;

procedure TForm1.ComPortRxChar(Sender: TObject; Count: Integer);
var
  Str,temp, ZW_WAR: String;
  DateTime : TDateTime;
  b,Nodeadresse:byte;
  dbm, D751, HeatSink, HeatFlux,thot,tcold,DT,TEGV,Ubat,Pout,rssi,energybalance :double;
  a:byte;
  dummy:integer;
  letzte:longint;
begin
    Timer1.Interval := 10000;
    SMsg := 'Please get up and relax your eyes';
  Timer1.Enabled := True;
  //get actual data and store it in "str"
  ComPort.ReadStr(Str, Count);
  //store every char from str in "rawdata" until cr + lf
  for a := 1 to length(str) do begin
    inc(laenge);
    rawdata[laenge]:=ord(str[a]);
    if (rawdata[laenge]=10) and (rawdata[laenge-1]= 13)then begin
      // if received protocol have the defined length of 11 then it is the right one
      if laenge=11 then begin
         //give rawdate from "rawdata" to "rawdata2" and clear rawdata
         for dummy:=1 to 11 do begin rawdata2[dummy]:=rawdata[dummy];rawdata[dummy]:=0;end;
         edit6.Text:='';
         for dummy:= 1 to 11 do edit6.Text:=edit6.Text+inttostr(rawdata2[dummy])+' ';
         nodeadresse:=ord(rawdata2[1]);
         //check if the address of the actual TE-Power-NODE already exists or not
         if nodeadressen[1]=0 then begin nodeadressen[1]:=nodeadresse;pagecontrol1.Pages[0].Caption:='NODE '+inttostr(nodeadresse);end;
         node:=99;
         for dummy:=1 to nodeanzahl do
             if nodeadressen[dummy]=nodeadresse then node:=dummy;
             if node = 99 then if nodeanzahl<5 then begin
                inc(nodeanzahl);nodeadressen[nodeanzahl]:=nodeadresse;node:=nodeanzahl;
                pagecontrol1.Pages[nodeanzahl-1].Caption:='NODE '+inttostr(nodeadresse);pagecontrol1.Pages[nodeanzahl-1].TabVisible:=true;
end;

You may use the following:

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Timer1.Enabled := False;
  ShowMessage(SMsg);
end;

procedure TForm1.ComPortRxChar(Sender: TObject; Count: Integer);
var
  Str,temp, ZW_WAR: String;
  DateTime : TDateTime;
  b,Nodeadresse:byte;
  dbm, D751, HeatSink, HeatFlux,thot,tcold,DT,TEGV,Ubat,Pout,rssi,energybalance :double;
  a:byte;
  dummy:integer;
  letzte:longint;
begin
    Timer1.Interval := 10000;
    SMsg := 'Please get up and relax your eyes';
  Timer1.Enabled := True;
  //get actual data and store it in "str"
  ComPort.ReadStr(Str, Count);
  //store every char from str in "rawdata" until cr + lf
  for a := 1 to length(str) do begin
    inc(laenge);
    rawdata[laenge]:=ord(str[a]);
    if (rawdata[laenge]=10) and (rawdata[laenge-1]= 13)then begin
      // if received protocol have the defined length of 11 then it is the right one
      if laenge=11 then begin
         //give rawdate from "rawdata" to "rawdata2" and clear rawdata
         for dummy:=1 to 11 do begin rawdata2[dummy]:=rawdata[dummy];rawdata[dummy]:=0;end;
         edit6.Text:='';
         for dummy:= 1 to 11 do edit6.Text:=edit6.Text+inttostr(rawdata2[dummy])+' ';
         nodeadresse:=ord(rawdata2[1]);
         //check if the address of the actual TE-Power-NODE already exists or not
         if nodeadressen[1]=0 then begin nodeadressen[1]:=nodeadresse;pagecontrol1.Pages[0].Caption:='NODE '+inttostr(nodeadresse);end;
         node:=99;
         for dummy:=1 to nodeanzahl do
             if nodeadressen[dummy]=nodeadresse then node:=dummy;
             if node = 99 then if nodeanzahl<5 then begin
                inc(nodeanzahl);nodeadressen[nodeanzahl]:=nodeadresse;node:=nodeanzahl;
                pagecontrol1.Pages[nodeanzahl-1].Caption:='NODE '+inttostr(nodeadresse);pagecontrol1.Pages[nodeanzahl-1].TabVisible:=true;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Timer1.Enabled := False;
  ShowMessage(SMsg);
end;

For this code, I have to put under the TTimer procedure is it?

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Timer1.Enabled := False;
  ShowMessage(SMsg);
end;

For this code, I have to put under the TTimer procedure is it?

That is obviously Timer1Timer procedure:)

ok. I will try... Thank you.

SMsg := 'Please get up and relax your eyes';

Is this a pop-up screen when I run the program?

SMsg := 'Please get up and relax your eyes';

Is this a pop-up screen when I run the program?

No, this is a string for a popup-window, because variable SMsg is a string variable ....

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Timer1.Enabled := False;
  ShowMessage(SMsg); // <= But this is a popup-Window;
end;

No, this is a string for a popup-window, because variable SMsg is a string variable ....

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Timer1.Enabled := False;
  ShowMessage(SMsg); // <= But this is a popup-Window;
end;

1st question :

Timer1.Interval := 10000;
    SMsg := 'Please get up and relax your eyes';
  Timer1.Enabled := True;

After it counts, the pop-up screen will appear but after I click OK will the pop-up screen appear again?

2nd question :

procedure TForm1.Timer1Timer(Sender: TObject);
begin  
Timer1.Enabled := False;  
ShowMessage(SMsg); // <= But this is a popup-Window;
end;

For the code above, when I run the program, the pop-up screen will appear. But if I don't want any pop-up screen before I click the RUN button, what shpuld I do?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.