Re: [ROOT] canvas created but not drawn ...

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Apr 11 2003 - 23:04:29 MEST


Jacek,

A small example of main program producing a canvas.
This requires a TApplication, but not a TApplication::Run

Rene Brun

#include "TApplication.h"
#include "TCanvas.h"
#include "TPaveLabel.h"
   
int main(int argc, char **argv)
{
   TApplication theApp("App", &argc, argv);
   TCanvas *c = new TCanvas("c", "The Hello Canvas", 400, 400);
   TPaveLabel *hello = new TPaveLabel(0.2,0.4,0.8,0.6,"Hello World");
   hello->Draw();
   c->Update();
   getchar();
   return 0;
}


On Fri, 11 Apr 2003, 
Jacek M. Holeczek wrote:

> Many thanks for help,
> 
> > I have the impression that you are running in batch mode. This is the
> > case when you do not define a TApplication object or if explictly
> > you call gROOT->SetBatch(kTRUE); Please check.
> 
> I do not create "TApplication" (and I do not say "gROOT->SetBatch(kTRUE)").
> Earlier today I had the idea to try "gROOT->SetBatch(kFALSE)" just before
> making the new TCanvas, but it didn't help.
> 
> Can I somehow convince TROOT to draw my TCanvas without creating the
> "TApplication" ?
> 
> > About your point with c->Draw, you should not do:
> >   c->Draw(); c->Update();
> > but
> >   c->Modified(); c->Update();
> 
> This code is more than one year old (was running fine with 3.02, if I
> remember well). It redraws the canvas using new contents of histograms
> every 10 seconds. The sequence "c->Draw(); c->Update();" was found
> EXPERIMENTALLY by me. No other sequence was behaving properly (including
> "c->Modified(); c->Update();"). It may well be that now I can change it.
> Well, I could make some tests ... as soon as I get the canvas drawn.
> 
> Thanks in advance,
> Jacek.
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET