Delphi Can
Application.ProcessMessages in Android - Baskı Önizleme

+- Delphi Can (https://www.delphican.com)
+-- Forum: Delphi (https://www.delphican.com/forumdisplay.php?fid=3)
+--- Forum: Mobil Platform - FireMonkey (FMX) (https://www.delphican.com/forumdisplay.php?fid=7)
+--- Konu Başlığı: Application.ProcessMessages in Android (/showthread.php?tid=5493)



Application.ProcessMessages in Android - gbg - 04-12-2020

Hello

why "Application.ProcessMessages" not work in Android?


Cvp: Application.ProcessMessages in Android - RAD Coder - 04-12-2020

ProcessMessages allows the jobs waiting in the queue to be temporarily transferred to the main thread by leaving the current thread. 
I do not recommend using ProcessMessages in FMX Multi-platform architecture. Instead of ProcessMessages, write small subroutines. Synchronize or queue each subroutine in a new thread.


Cvp: Application.ProcessMessages in Android - gbg - 04-12-2020

(04-12-2020, Saat: 12:57)RAD Coder Adlı Kullanıcıdan Alıntı: ProcessMessages allows the jobs waiting in the queue to be temporarily transferred to the main thread by leaving the current thread. 
I do not recommend using ProcessMessages in FMX Multi-platform architecture. Instead of ProcessMessages, write small subroutines. Synchronize or queue each subroutine in a new thread.
Yes I khow but Embarcadero use it!

See FMX.Ani

class procedure TAnimator.AnimateIntWait(const Target: TFmxObject; const APropertyName: string; const NewValue: Integer;
 Duration: Single = 0.2; AType: TAnimationType = TAnimationType.In;
 AInterpolation: TInterpolationType = TInterpolationType.Linear);
var
 Animation: TIntAnimation;
begin
 StopPropertyAnimation(Target, APropertyName);

 Animation := TIntAnimation.Create(nil);
 try
   Animation.Parent := Target;
   Animation.AnimationType := AType;
   Animation.Interpolation := AInterpolation;
   Animation.Duration := Duration;
   Animation.PropertyName := APropertyName;
   Animation.StartFromCurrent := True;
   Animation.StopValue := NewValue;
   Animation.Start;
   while Animation.FRunning do
   begin
     Application.ProcessMessages;
     Sleep(0);
   end;
 finally
   Animation.DisposeOf;
 end;
end;


I use AnimateIntWait in project , in windows run correct but in android UI don`t response to user because use "Application.ProcessMessages;"

Your comment was edited because it contains invalid code formatting. Please use code formatting in code shares!


Cvp: Application.ProcessMessages in Android - pro_imaj - 04-12-2020

(04-12-2020, Saat: 12:32)gbg Adlı Kullanıcıdan Alıntı: Hello

why "Application.ProcessMessages" not work in Android?

Hi,

You can find official answers on this topic here, unfortunately, for now you have to move forward with other solutions.

Good work.


Application.ProcessMessages in Android - gbg - 04-12-2020

but "Application.ProcessMessages" work in Android with D10.2


Cvp: Application.ProcessMessages in Android - RAD Coder - 04-12-2020

You can use the following workaround with Delphi 10.4.
  TThread.CreateAnonymousThread(
   procedure
   begin
     TAnimator.AnimateFloat(Arc1, 'EndAngle', 360, 1.3);
     TThread.Sleep(13 * 100);
     TAnimator.AnimateFloat(Arc1, 'EndAngle', 0, 1.3);
   end).Start;





Cvp: Application.ProcessMessages in Android - gbg - 05-12-2020

(04-12-2020, Saat: 17:04)RAD Coder Adlı Kullanıcıdan Alıntı: You can use the following workaround with Delphi 10.4.
  TThread.CreateAnonymousThread(
   procedure
   begin
     TAnimator.AnimateFloat(Arc1, 'EndAngle', 360, 1.3);
     TThread.Sleep(13 * 100);
     TAnimator.AnimateFloat(Arc1, 'EndAngle', 0, 1.3);
   end).Start;

Thanks
But I need to wait in the main thread
I have a CriticalSection and I want the main thread to wait for the end