Strange Problem [SOLVED] lazarus / 21-General ---------------------------------------------------------------------- SteveSS · 2021-02-13 16:28 Hi Chaps.  Thought I would waste an hour writing a program to display a calendar / clock. It could not be more simple.  One form containing two labels and a close button. The first label caption is set to the date e.g. SATURDAY 13 FEBRUARY 2021 The second label caption is set to the time e.g. 16:20:35 The procedure that sets the two label captions is called from the form activate routine, and the day/month names are set in the form create routine into string arrays. Works fine if I just run it once but if I put the procedure call into a while 1 = 1 loop so that the time changes it doesn't work at all - the form is not displayed correctly - no colour and the standard top right buttons don't work, and the label captions are not set at all. Can't see what I am doing wrong.  Any suggestions? Steve ---------------------------------------------------------------------- wp · 2021-02-13 16:34 You probably have to call "Application.ProcessMessages" inside the loop to check and handle any clicks, key presses, repaint requests that have accumulated. But you should be aware that such a while loop may be blocking your CPU. I'd prefer to use a Timer which fires every second (or more often if you cannot live with max 1 second delay), and in its OnTimer event you read the time and update the labels. ---------------------------------------------------------------------- SteveSS · 2021-02-13 16:43 Thanks wp.  Added a timer and it works perfectly.