I did try to use TApplication.
Below is a listing of how I tried to do it.
I will be the first to admit I don’t know what I’m doing. There are probably
a lot of errors in this.
When I run this, well, basically nothing appears on the screen (no little
window with a progress bar) but the analysis loop completes with no problems.
Glenn
main program
#include <TROOT.h>
#include <TApplication.h>
#include “VAProgress.h”
.
.
.
int main(int argc, char** argv)
{
//.
//.
//Bunch more stuff, nothing to do with ROOT
//.
//.
TROOT root(“Analysis”,“Analyse Events”);
TApplication theApp(“App”,&argc,argv);
VAProgress* fAnlProgressBar = new VAProgress(gClient->GetRoot());
//.
//Start of analysis loop
//…
//.
//just before end of analysis loop
float fProg=(float)nEvent/(float)fNumArrayEvents;
fAnlProgressBar->UpdateProgress(fProg);
} //End analysis loop
//.
//.
} //end of main
//VAProgress.h******************************
#include <TGWindow.h>
#include <TGFrame.h>
#include <TGProgressBar.h>
#include <TGClient.h>
class VAProgress: public TGMainFrame
{
private:
TGHProgressBar* fProgress;
public:
VAProgress(const TGWindow* p);
~VAProgress();
void UpdateProgress(float fProg);
};
VAProgress::VAProgress(const TGWindow* p):TGMainFrame(p,300,300)
{
fProgress = new TGHProgressBar(this,TGProgressBar::kStandard,300);
fProgress->SetBarColor(“blue”);
fProgress->SetRange(0.,1.0);
fProgress->ShowPosition(kTRUE,kFALSE);
this->AddFrame(fProgress,new TGLayoutHints(kLHintsTop |
kLHintsLeft | kLHintsExpandX,5,5,5,10));
this->SetWindowName(“Analysis Progress”);
this->MapSubwindows();
this->Resize(this->GetDefaultSize());
this->MapWindow();
return;
}
VAProgress::~VAProgress()
{
//nothing to do
}
void VAProgress::UpdateProgress(float fProg)
{
fProgress->SetPosition(fProg);
return;
}