TGProgressBar works under linux but not under Mac

Hi all

I am trying to add a progress bar to my app. When I do this inside a loop:

fprogressbar->Increment(1);
gSystem->ProcessEvents();

It does what you would expect under linux. But in macOS it only updates when mouse is moving and the app window is in focus. Any ideas? Thanks.

gSystem->DispatchOneEvent();
gSystem->ProcessEvents();

fixed this.