Re: [ROOT] TGLabel + ChangeBackground

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Thu Jul 13 2000 - 22:39:03 MEST


Hi Otto,

   a TGLabel's background is only redrawn after the label's text has been reset.
So you could do:

   ULong_t yellow;
   gClient->GetColorByName("yellow", yellow);
   label->ChangeBackground(yellow);
   TGString *s = new TGString(label->GetText());
   label->SetText(s);  // new label is adopted and old (identical) label is
deleted


Cheers, Fons.



Otto Schaile wrote:
> 
> Hi Rooters,
> I would like to change the background color of a TGLabel immediatly.
> So I try:
>    TGLabel * label =...
> ..
>    ULong_t yellow;
>    gClient->GetColorByName("yellow", yellow);
>    label->ChangeBackground(yellow);
>    gClient->NeedRedraw(label);
> ...
> The color however changes only after  push down - pop up
> of the window the label is in.
> 
> Changing text on the other side works immediatly.
> Thanks in advance for a hint.
> 
> Cheers
> Otto
> ------------------------------------------------------------------------
> Otto Schaile                Sektion Physik, LMU Muenchen
> Phone: +49 89 289 14070     Am Coulombwall 1, D-85748 Garching, Germany
> GSM:   +49 171 4312031
> FAX:   +49 89 289 14072     EMail: Otto.Schaile@Physik.Uni-Muenchen.DE

-- 
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 02 2001 - 11:50:29 MET