Getting Progress Bar to Update

How do I get the progress bar (TGHProgressBar) to update? Are there any examples of using this class out there?

Hi,

The update should be automatic, see examples in $ROOTSYS/tutorials/gui/guitest.C

Cheers, Bertrand.

I found in the guitest.C example the method I was looking for. It was Increment(). I used it to increment the number of events I am sorting as in the example of fHProg2->ShowPosition(kTRUE, kFALSE, “%.0f events”), but how do I set the value for the maximum event number? It seems to be 100 by default and I do not know how to change this.

root.cern.ch/root/html/TGProgres … r:SetRange

I was able to change the range of the progress bar. Thanks.

I still have a problem with viewing the incremental updates in my progress bar. It seems to only update at the very end. For example, if I have 10 events, the progress bar goes from 0 to 10 with nothing shown in between. In the guitest.C example, I see that there is a call to gSystem->ProcessEvents(). Is this needed for seeing each increment? I also do not know how to try this since I am not using the CINT interpreter and my program is compiled.

Yes, if you increment the progress bar in a loop, you have to call gSystem->ProcessEvents(), in order to process events (like updating the GUI…). And this has nothing to do with CINT (see also $ROOTSYS/test/guitest, which is compiled as well)

Looking again at the guitest.C example, I was missing the TROOT.h and TSystem.h headers for using the gSystem->ProcessEvents() call. With those in, my program compiles and the progress bar updates as I expect :slight_smile: .