[SOLVED] Timer in a linux console lazarus / 32-Linux ---------------------------------------------------------------------- vexal · 2011-08-25 12:06 Hi ! I implemented a TTimer in a crossplatform console application. Under Windows, i made a infinite loop that process messages for TTimer with this code : Code: [Select]procedure ProcessMessages; var   Msg: TMsg; begin   while PeekMessage(Msg, 0, 0, 0, PM_REMOVE) do begin     if Msg.Message <> WM_QUIT then begin       TranslateMessage(Msg);       DispatchMessage(Msg);     end else       exit;   end; end; But under Linux, i cannot make it work because TranslateMessage and DispatchMessage are in the windows unit. Do you know how i can do ? ---------------------------------------------------------------------- Leledumbo · 2011-08-25 16:17 LCL's TTimer is already cross platform. You can use it from console apps by selecting NoGUI widgetset. Or directly use TFPTimer instead. ---------------------------------------------------------------------- vexal · 2011-08-26 08:19 Thank you ! I tried with tfptimer but it is the same, my "timer" function is never called. I tried with nogui widgetset but i get an exception : No timers available (Lazarus 0.9.30 x64 CentOs 6) ---------------------------------------------------------------------- vexal · 2011-08-26 08:31 I add checkSynchronize in my infinite loop and it works well now with fptimer : Code: [Select]while true do   begin     checkSynchronize;     sleep(10);   end; Thank you very much ! ---------------------------------------------------------------------- Leledumbo · 2011-08-26 09:11 Glad to know that. I don't know what's wrong with your way of using TFPTimer (since you didn't post any code), but just ensure you have its Enabled property set to true, Interval to some milliseconds and OnTimer with the handler correctly. ---------------------------------------------------------------------- vexal · 2011-09-02 08:00 I am using fptimer and it works (with checkSynchronize) but only if i compile with gtk2 widgetset under linux and win32 widgetset under windows. My program will work in a linux system (centos 6 minimal) without any gui (no xwindow). If i want to compile it with the nogui widgetset, the compilation is ok but when i execute it, i have the message : Quoteexception at 00000000006781A7: No timer available.Is it because the the fptimer is not implemented in the nogui widgetset ? ---------------------------------------------------------------------- vexal · 2011-09-02 08:53 Sorry, the exception was due to a ttimer left in my code in a "deep" function. The fact it works with some widgetset and not the nogui is odd anyway. Thank you