here follows a small variation of the graphics test program
that shows that you do not need, per se, to call TApplication::Run()
to get the canvas on the screen. Just hit <return> to pass getchar().
I also shows a new feature (available in the 1.00 beta by the end of
the week) of how to return from Run() without destroying the canvas.
Cheers, Fons.
//-------------------------------
#include <stdio.h>
#include "TROOT.h"
#include "TApplication.h"
#include "TCanvas.h"
#include "TLine.h"
extern void InitGui();
VoidFuncPtr_t initfuncs[] = { InitGui, 0 };
int Error; // needed by Motif
TROOT root("martin","Martin's ROOT", initfuncs);
int main(int argc, char **argv)
{
TApplication theApp("App", &argc, argv);
TCanvas *c = new TCanvas("Picture", "The Alignment Geometry", 400,
400);
c->Show();
TLine *l = new TLine(0.1,0.2,0.5,0.9);
l->Draw();
c->Update();
// Enjoy picture, hit <return> to continue
getchar();
l = new TLine(0.9,0.5,0.1,0.2);
l->Draw();
c->Update();
// Enter event loop, one can now interact with the objects in
// the canvas. Select "Exit ROOT" from Canvas "File" menu.
// This works only with ROOT v1.00 beta.
theApp.SetReturnFromRun();
theApp.Run();
l->SetX1(0.2);
c->Modified(); // Need to tell canvas an existing object has been
modified
c->Update();
// Hit return to exit
getchar();
return 0;
}
//----------------------------------------
Sergei Gerassimov wrote:
>
> Hi Fons,
>
> Thanks for instant reply.
> Following test works fine, but I not really understand
> what theApp->Run() does and how one could quit from it.
> Say, if I just want to draw event, look on it, and
> go to next one, how I have to proceed?
>
> Thank you, sorry for silly questions.
> Sergei
>
-- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland Phone: +41 22 7679248 E-Mail: Fons.Rademakers@cern.ch Fax: +41 22 7822601