Hi,
I have a standalone gui program, using TRootEmbeddedCanvas, and i can’t do wat i want.
I would like to display Root Tracks with TGeoManager in a TRootEmbeddedCanvas.
#include "MdiTrackAnimation.hxx"
#include <TCanvas.h>
#include <TGeoManager.h>
#include <TFile.h>
#include <TKey.h>
#include <iostream>
using namespace std;
ClassImp(MdiTrackAnimation)
MdiTrackAnimation::MdiTrackAnimation(TGMdiMainFrame *p) : TGMdiFrame(p, 600, 500)
{
// ec1_ = new TRootEmbeddedCanvas("ec1",this,100,100);
// this->AddFrame(ec1_, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
// ec1_->GetCanvas()->cd();
TGeoManager * geom_;
TFile * f = new TFile("./myfile.root");
Bool_t fin = kFALSE;
TKey *key = 0;
TIter* objIter = new TIter(f->GetListOfKeys());
while (!fin && (key=(TKey*) objIter->Next()))
{
if (strcmp(key->GetClassName(),"TGeoManager") == 0 )
{
geom_ = (TGeoManager * )(key->ReadObj());
fin = kTRUE;
}
}
geom_->SetTminTmax(9e-9, 1e-8);
geom_->DrawTracks();
gPad->Modified();
gPad->Update();
this->SetWindowIcon(gClient->GetPicture("profile_t.xpm"));
this->SetMdiHints(kMdiDefaultHints);
this->SetWindowName("Track Animation");
this->MapSubwindows();
this->Layout();
}
This code works fine and open the tracks in a new TCanvas
But if i uncomment the 3 lines at the beginning, it doesn’t work, and i don’t understand why.
The TRootEmbeddedCanvas is diplayed, but empty (white).
Any idea?
Laurent.