Hi Craig, with the released version of ROOT this is not possible. The buttons are created directly by X11 or Win32 and there is no API to get a pointer to these buttons and change their colors. However, I've just committed a change in the ROOT CVS that will allow you to get access to these buttons on X11 systems, where the buttons are TGTextButtons, so you can manipulate their properties. The interface requires some internal knowledge of the control bar implementation (which is not ideal) but here is how you can do it: { TControlBar bar("vertical"); bar.AddButton("foo","printf(\"foo\\n\");","Print foo"); bar.AddButton("bar","printf(\"bar\\n\");","Print bar"); bar.Show(); // make background of "bar" button yellow TRootControlBar *imp = (TRootControlBar *)bar.GetControlBarImp(); TIter next(imp->GetWidgets()); TObject *w; while ((w = next())) { if (w->IsA() == TGTextButton::Class()) { TGTextButton *tb = (TGTextButton*)w; if (tb->GetString() == "bar") { ULong_t yellow; gClient->GetColorByName("yellow", yellow); tb->ChangeBackground(yellow); } } } } Cheers, Fons. On Mon, Mar 05, 2001 at 11:42:39AM +1000, Craig Everton wrote: > > I'm using TControlBar to create a button pad with 10 buttons. I would like > if possible to change the colours of some of the buttons. Eg make my > "go" button green whilst leaving the rest of the buttons the same colour. > Does anyone know how to do this ? > > Thanks in advance > > Craig > > -====================================================== > Craig Everton > Experimental Particle Physics (EPP) > School of Physics > University of Melbourne, Victoria > AUSTRALIA 3010 > Phone : (work) (613) 9344 5075 > (home) (613) 9387 6726 > Fax : (613) 9347 4783 > Email : everton@liszt.ph.unimelb.edu.au > ====================================================== > -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7677910
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:38 MET