Re: [ROOT] Is it possible to use TAttFill->SetFillAttributes() with undrawn object?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Jun 05 2003 - 21:40:41 MEST


Hi Micha,

See an example in class TLegend::EditEntryAttFill

void TLegend::EditEntryAttFill()
{
  // Edit the fill attributes for the entry pointed by the mouse
  TLegendEntry* entry = GetEntry();   // get entry pointed by the mouse
  if ( !entry ) return;
  gROOT->SetSelectedPrimitive( entry );
  entry->SetFillAttributes();
}

see the two last statements


Rene Brun

On 
Wed, 
4 Jun 2003, Micha 
D. Niskin wrote:

> Hello!
> 
> 	Thank you for your help so far, I can't tell you how much I appreciate it. I 
> have a class which inherits from TObject and TAttFill. The object itself is 
> not drawn in a pad, but some of the objects it contains are drawn. I wish to 
> be able to use the TAttFillCanvas to change fill attributes for my object 
> (where I intend to write my own SetFillColor and SetFillStyle methods). 
> However it appears that it needs to have the object selected somewhere to 
> access SetFillColor method. Here's what I have tried so far:
> 
> 	root[0] MyClass *myobj = new MyClass;
> 	root[1] gPad->SetSelected(myobj);
> 	root[2] myobj->SetFillAttributes();
> 	root[3] TList *l = gROOT->GetListOfCanvases();
> 	root[4] TAttFillCanvas *fill = (TAttFillCanvas*) l->FindObject("R__attfill");
> 	root[5] fill->SetRefObject(myobj);
> 
> >From looking at the source I would think that I would be able to then change 
> the fill attributes by clicking a button and then clicking "APPLY" button. 
> However this does not work for me. The "gStyle" button does work, however. 
> Please, any help would be greatly appreciated. Thanks!
> 
> 



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