Cursor shape does not change unless I add Application.ProcessMessages lazarus / 32-Linux ---------------------------------------------------------------------- fedkad · 2022-01-27 10:25 Create a new project with an empty form. Add a button and put the following code to the OnClick event: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   Screen.BeginWaitCursor;  sleep(2000);  Screen.EndWaitCursor; On Windows it will act as expected. However, on Linux the cursor shape will not change. You have to change the Linux code to something like this to work: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   Screen.BeginWaitCursor;  Application.ProcessMessages;  sleep(2000);  Screen.EndWaitCursor; Why? ---------------------------------------------------------------------- Zvoni · 2022-01-27 11:03 Quote from: fedkad on January 27, 2022, 11:25:15 amWhy? [SARCASM ON] Because this has nothing to do with installing Lazarus/FPC on Linux? [SARCASM OFF] ---------------------------------------------------------------------- trev · 2022-01-27 11:08 Moving from Linux > Installation sub-forum to OS > Linux sub-forum ... just for context for Zvoni's response ---------------------------------------------------------------------- fedkad · 2022-01-27 11:41 Thanks for moving the topic and sorry for posting to wrong section! ---------------------------------------------------------------------- Zvoni · 2022-01-27 12:56 As for the original question: https://lists.lazarus- ide.org/pipermail/lazarus/2011-April/192333.html QuoteThe LCL is not a winapi emulator.Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Screen.BeginWaitCursor;{$IFDEF LINUX}Application.ProcessMessages;{$END IF}sleep(2000);Screen.EndWaitCursor; ---------------------------------------------------------------------- fedkad · 2022-01-27 13:22 Quote from: Zvoni on January 27, 2022, 01:56:49 pmAs for the original question: https://lists.lazarus- ide.org/pipermail/lazarus/2011-April/192333.html QuoteThe LCL is not a winapi emulator.Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Screen.BeginWaitCursor;{$IFDEF LINUX}Application.ProcessMessages;{$END IF}sleep(2000);Screen.EndWaitCursor;  That is what I am using right now. But, I just wanted to reduce those {$ifdef Linux}Application.ProcessMessages;{$endif}s in my program. ---------------------------------------------------------------------- Zvoni · 2022-01-27 13:40 Well then. The link above has the answer: the LCL is not a winapi- emulator. On windows, the WinAPI itself makes sure the screen-object is updated (and that way showing the change of cursor) ---------------------------------------------------------------------- Josh · 2022-01-27 13:56 Hi To save all the if def you could ceate a proc; Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure Do_Application_Processes_By_Os;inline;begin  {$ifdef linux}  Application.ProcessMessages;  {$endif}end; then you could add the code into your routines; Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Screen.Begi nWaitCursor;Do_Application_Processes_By_Os;sleep(2000);Screen.EndWaitC ursor; or create youself the set cursor routine; Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure Do_BeginWaitCursor;inline;begin  // under windows cursor state is set immediately by winapi  // under linux you must call processmessage to force the state change to happen.  Screen.BeginWaitCursor;  {$ifdef linux}  Application.ProcessMessages;  {$endif}end; procedure Do_EndWaitCursor;inline;begin  // under windows cursor state is set immediately by winapi  // under linux you must call processmessage to force the state change to happen.  Screen.EndWaitCursor;  {$ifdef linux}  Application.ProcessMessages;  {$endif}end; ...... Do_BeginWaitCursor;sleep(2000);Do_EndWaitCursor; ---------------------------------------------------------------------- zeljko · 2022-01-27 14:16 Quote from: fedkad on January 27, 2022, 11:25:15 amCreate a new project with an empty form. Add a button and put the following code to the OnClick event: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   Screen.BeginWaitCursor;  sleep(2000);  Screen.EndWaitCursor; On Windows it will act as expected. However, on Linux the cursor shape will not change. You have to change the Linux code to something like this to work: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   Screen.BeginWaitCursor;  Application.ProcessMessages;  sleep(2000);  Screen.EndWaitCursor; Why? What widgetset under linux ? I'm using qt/qt5 and haven't spotted such problem. ---------------------------------------------------------------------- MarkMLl · 2022-01-27 14:26 Quote from: zeljko on January 27, 2022, 03:16:27 pmWhat widgetset under linux ? I'm using qt/qt5 and haven't spotted such problem. That being a massively-important omission from the OP. Calling Application.ProcessMessages is unavoidable if one wants the UI to be immediately-responsive to minor changes. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i       Screen.BeginWaitCursor;      sleep(2000);    // SUSPENDS ENTIRE PROGRAM: DOES NOT CALL APM      Screen.EndWaitCursor;  In any event, one has to be careful overusing APM: if it's in code that's called- even indirectly- via Synchronize() then it can go recursive. MarkMLl ---------------------------------------------------------------------- fedkad · 2022-01-27 16:02 Quote from: zeljko on January 27, 2022, 03:16:27 pmWhat widgetset under linux ? I'm using qt/qt5 and haven't spotted such problem. I am using GTK2. That info was already given in my signature. Josh's proposal seems to be the closest solution to my problem. Thanks. Sleep was actually a placeholder for a group a statements that do file and/or network IO and may take a few seconds to complete.