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?
1-st answer :
Timer1.Interval := 10000;
SMsg := 'Please get up and relax your eyes';
Timer1.Enabled := True;
After it counts, the pop-up window will appear but after you click OK the pop-up window will not appear again, because inside the Timer1Timer procedure is a code:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled := False; // <= This prevents from another popup-window until Timer1 be activated again
ShowMessage(SMsg);
end;
2-nd answer :
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled := False;
ShowMessage(SMsg); // <= But this is a popup-Window;
end;
For the code above, when you run the program, the pop-up screen will appear BECAUSE YOU FORGOT YOUR Timer1's property Enabled True, but it must to be False, for not cause a popup-window at startup the program.