Hi Rooters, I have a problem with using 'the' default/basic colors for TAttLine etc.. (i.e. indixed by Color_t). When I used a TCanvas somehwere in my code it seemed that the colors where not defined. This problem occured somewhere deep in my class structure. I have traced the problem done to the following: code: ---------------- // Create Canvas before //TCanvas *cBefore = new TCanvas("cBefore","canvasBefore",600,10,600,400); // get picture from picture pool... // gClient->GetPicture("home_t.xpm"); gClient->GetPicture("LHCb2.xpm"); // Create Canvas after TCanvas *cAfter = new TCanvas("cAfter","canvasAfter",600,10,600,400); --------------- The 'basic color' table is initialized the first time when a TCanvas is made (i.e. by TCanvas::Build()). In this method it is checked if the color list (i.e. retrieved by gROOT->GetListofColors()) is empty, if this is so the 'basic colors' are added. In this way everything should go well if the list of colors remains empty until the first canvas is constructed. In my particlar case (see above). It seems that by retrieving the picture 'LHCb2.xpm', somehow the list isn't empty anymore. Consequently if I make a canvas (cAfter) after retrieving the picture the 'basic colors' are not initialized. If I first add a canvas (cBefore) the list is correctly initialized. (I checked this by doing View->Colors in the canvas menubar) I hardly know anything about the xpm format. I also don't know what exactly happens by retrieving such a picture inside gClient. So I don't know if it is strange that the retrieving the picture LHCb2.xpm causes the addition of colors (if I add the standard home_t.xpm, there are no problems!) In much more general terms though, it seems strange to me that before using the 'basic colors' I should first make a TCanvas. If the colors are mend to be some sort of 'default ROOT colors' I think they should be initialized even before constructing the first TCanvas (maybe when gClient is made?). In my specific case I need to get the picture before constructing the TCanvas. I might even think of situations where you use the colors without making a TCanvas at all... Are the 'basic colors' mend to be as I describe above (i.e. ROOT default)? Thanks, Rutger p.s. Fons/Rene I could send you LHCb2.xpm if you want it. p.s.2 HP-UX 10 aCC compiler
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:37 MET