Application only updating when i move mouse lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- Josh · 2015-08-20 07:34 Hi I have an application that retrieves data then updates a tmemo. The code is working fine, however the TMemo is only visually being updated if I move or click the mouse. I cannot use application.processmessages as this causes problems and is not really thread safe. Any ideas, under windows I use a procedure that processes message; which works fine. But this will not work under OSX. Any Ideas. Josh ---------------------------------------------------------------------- howardpc · 2015-08-20 07:43 Quote from: josh on August 20, 2015, 09:34:06 amI cannot use application.processmessages as this causes problems and is not really thread safe. What problems arise from the ProcessMessages call? In what way is it not thread safe? Have you tried calling yourMemoName.Invalidate after you change the Lines property (though I can't think why inserting this call manually should be needed)? Perhaps you need to share the code you use to update the memo contents. ---------------------------------------------------------------------- Josh · 2015-08-20 07:55 Hi Code using to update controls Code: [Select]memo1.lines.add(s); memo1.update; If I add processmessage as the data being generated is in a callback routine, now and again it will crash out. In Windows I would use a routine like this which would work perfectly. Code: [Select]procedure WaitForallmessages; var   Msg: TMsg; begin   if not doing_messages then   begin     while ((PeekMessage(Msg, 0, 0, 0, PM_REMOVE))) do     begin       doing_messages:=true;       if Msg.message = WM_QUIT then       begin         PostQuitMessage(Msg.wParam);         Break;       end;       TranslateMessage(Msg);       DispatchMessage(Msg);     end;     doing_messages:=False;   end; end;            Doing_messages is a public variable defined doing_messages:boolean=false; ---------------------------------------------------------------------- howardpc · 2015-08-20 08:41 Code snippets are not much help in debugging the work of others. Compilable code demonstrating the fault is needed. ---------------------------------------------------------------------- Josh · 2015-08-20 08:54 Hi, Unfortunately that is not easy, as it requires specific hardware connected. I will try to create an application that simulate the data arriving so that to demonstrate the problem. Josh ---------------------------------------------------------------------- Graeme · 2015-08-20 17:03 Quote from: josh on August 20, 2015, 09:55:40 amCode: [Select]memo1.lines.add(s); memo1.update; I haven't tried your code personally, but maybe change the above to Code: [Select]memo1.BeginUpdate; memo1.Lines.add(s); memo1.EndUpdate; Something like that.... I don't know LCL by heart, but if the above is wrong, try memo1.lines.beginupdate (and .endupdate) instead ---------------------------------------------------------------------- ZXDunny · 2016-03-31 09:21 Sorry for the thread necro, but I also got this issue in OSX 10.11, until I selected the option in project options to automatically build a bundle for my application. Prior to that, I only got updates to the UI when I moved the mouse or clicked/dragged - looked to be something to do with Lazarus running the app as a terminal application. ---------------------------------------------------------------------- SymbolicFrank · 2016-03-31 09:42 Do you update the GUI from a different thread?