Re: Problems with graphics objects.

Rene Brun (Rene.Brun@cern.ch)
Thu, 14 Aug 1997 11:24:31 +0200


basil@hbaxp04.mppmu.mpg.de wrote:
>
> Hello,
>
> I have had some problems in the past week with root.
>
> I am writing a online display for our experiment with root. So I do not use the
> Cint interpreter, but compile everything together.
> When I take a TPad, draw a box into it and then some lines into the box I get a
> nice picture for my first Event - It's like I want it to be. But how can I
> remove the Tbox and the Tlines from that TPad again?
> I tried it by putting the grafics objects into a TObjArray and to delete them
> one after the other when they are not longer needed - but this did a fault and
> the application stopped. Also TObjArray->Delete() did the same.
> So how can I remove the TLines and TBoxes?
>

There are several ways of deleting objects from a pad in batch mode.
Assume a pad created with the following objects:
TCanvas c1("c1")
TLine *line1=new TLine(.1,.1,.9,.7)
line1.Draw()
TLine *line2=new TLine(.1,.8,.8,.2)
line2.Draw()
TBox *box1=new TBox(.2,.2,.5,.4)
box1.SetFillColor(42)
box1.Draw()

You can:
a, Delete all objects from a pad
c1->Clear();

b, Delete some objects
delete line1;
delete line2;
c1->Modified();
c1->Update();

c, keep the objects alive, but remove them from the pad
TList *glist = c1->GetListOfPrimitives();
glist->Remove(line1);
glist->Remove(box1);
c1->Modified();
c1->Update();


> Another problem occured when I tried to convert a TCanvas into a postscript
> file. Everthing worked as it should, only when using a shaded contour plot the
> whole output is getting messed (so now I don't use it...).
>

Could you tell me which fill color and fill style was used?
Some pattern styles are emulated under Postscript and may be
quite slow to print.

> And just a remark or the THtml class. I really love it =8->. But I really tried
> hard to get the automatic documentation running in a program which is linked.
> After a quite while I found out that you have to init first a TApplication,
> before you can define your THtml. This was not clear to me in advance! Perhaps I
> did not read the documentation carfully enough, but I did not find any
> references to that....

To generate the html documentation for a class, you must
generate the dictionary. See the root/test/Event example
how to generate a dictionary.
To generate the documentation, do:
THtml html;
html.MakeClass(classname);

Rene Brun