embedding ROOT

From: Pasha Murat (murat@cdfsga.fnal.gov)
Date: Fri Sep 26 1997 - 06:01:32 MEST


	This is kind of issue which people will never agree upon... 
	I'm trying to write a prototype of event display code
	based on ROOT graphics classes. By design this shoudn't be a 
	standalone application, instead it should be called by another routine:
	I need main to be loaded statically because otherwise there is no 
	way to debug the whole system. This is nothing but embedding ROOT
	into another application. Having started from test/hworld.cxx 
	I've been trying to make the code reentrant: after the event display 
	routine is executed, all the windows should be closed. The example below
	bombs. I guess that this is happening because TCanvas::Close() does 
	much more than just closing the window on the screen.

	Is it possible to modify the example below so it would close a canvas after
	the first call to TApplication::Run() and reopen it at the second call?

	I'd appreciate any hints on this subject.
							Thanks, Pasha.
--------------------------------------------------------------------------------
#include "TROOT.h"
#include "TApplication.h"
#include "TCanvas.h"
#include "TLine.h"
#include "TPaveLabel.h"

extern void   InitGui();
VoidFuncPtr_t initfuncs[] = { InitGui, 0 };
int           Error; 
TROOT         root("hello","Hello World", initfuncs);
TApplication* theApp;

main(int argc, char **argv) {
  TApplication  theApp("App", &argc, argv);
  TCanvas c("c", "The Hello Canvas", 400, 400);
  c.Update();
  theApp.Run(kTRUE);
  c.Close();
  c.Update();
  theApp.Run(kTRUE);
}
--------------------------------------------------------------------------------



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:21 MET