Re: Changing the color of a TNode

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Oct 01 1998 - 18:13:10 MEST


> 
> Does anyboy know how to change the color of a TNode after
> having constructed it ?
> 
> I tried e.g. in following the example  (copied from the
> tutorial), but I did not succeed.
> 
> Thanks,
>          Ivar.
> 
> {
>    gROOT->Reset();
>    c1 = new TCanvas("c1","Geometry Shapes",200,10,700,500);
>    brik = new TBRIK("BRIK","BRIK","void",200,150,150);
>    trd1 = new TTRD1("TRD1","TRD1","void",200,50,100,100);
>    brik->SetLineColor(1);
>    trd1->SetLineColor(2);
> 
>    node1 = new TNode("NODE1","NODE1","BRIK");
>    node1->cd();
>    node2  = new TNode("NODE2","NODE2","TRD1",0,0,-1000);
>    node1->cd();
> 
>    // changing the color after having created the nodes does not work
>    brik->SetLineColor(4);
>    trd1->SetLineColor(5);
> 
>    node1->Modified();
>    node1->Draw();
>    c1->Update();
> }

Ivar,
As implied by your question, you want to change the TNode color,
use TNode::SetLineColor.
I have simplified your macro below.

Rene Brun

{
   gROOT->Reset();
   c1 = new TCanvas("c1","Geometry Shapes",200,10,700,500);
   brik = new TBRIK("BRIK","BRIK","void",200,150,150);
   trd1 = new TTRD1("TRD1","TRD1","void",200,50,100,100);

   node1 = new TNode("NODE1","NODE1","BRIK");
   node1->cd();
   node2  = new TNode("NODE2","NODE2","TRD1",0,0,-1000);
   node1->cd();

   // changing the color after having created the nodes does not work
   node1->SetLineColor(4);
   node2->SetLineColor(5);

   node1->Draw();
   c1->Update();
}



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