Fmx update control without applicatio.processmessages

410 Views Asked by At

What is the best way to update FMX control without using Apllication.Processmessages method, וn main form.

Apllication.Processmessages call can cause to unwanted asynchrony user events to come in before operation completed.

We have old delphi XE5 in ms windows 10, i tried repaint and invalidate but it not help.

1

There are 1 best solutions below

2
Remy Lebeau On

Have the OnClick handler disable the button, start a background thread/task to do the actual work, show the "please wait" message, and then exit the OnClick handler. Do not block the main thread at all. Let it run so it can process UI work normally as needed.

When your background work is finished, have the thread/task notify the main thread, which can then dismiss the "please wait" message and re-enable the button.

DO NOT do the actual work in the OnClick handler itself, and DO NOT call Application.ProcessMessages() at all.