Hi, I'm not sure for Root 3.0. But for previous versions you are responsible of deleting all widgets you create in the destructor of your own class. In that sense one can also keep a pointer to the button you create as a datamember of the class and use it in the processMessage function. That way you don't need a casting operation and a lookup. I do not know if a function such as GetResourcePointerById( exists or not in ROOT, though. Best regards, Manuel On Wednesday 07 February 2001 11:17, Thomas Bretz wrote: > Hello, > > I created a class derived from TGMainFrame. > > In the constructor I create a button on top of the frame with something > like: > TGTextButton *but=new TGTextButton(this, "text", 555); > but ->MoveResize(13, 13, 13, 13); > > If I understood it right it is added to a list and deleted inside a > destructor (TGCLient?) > > In the ProcessMessage function of my class I need the pointer (eg to > disable the button). I would like do do something like: > TGTextButton *button=(TGTextButton*)GetResourcePointerById(555); // 555 > is the id of the button, see above > > Is this possible? > > Thankd, > Thomas.
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:35 MET