Re: TGPictureButton::DoReDraw(), Beepers, etc

Fons Rademakers (Fons.Rademakers@cern.ch)
Mon, 14 Dec 1998 14:54:25 +0100


Hi Xie,

> Several questions to disturb, please !
>
> (1). In 'guitest.cxx', I add:
>
> const TGPicture *pic ;
> ...........................
> pic = fClient->GetPicture("mb_stop_s.xpm");
> ................................
> fPictButton = new TGPictureButton(f1, pic, 100);
>
> and in ' ProcessEvent', I add the following :
>
> case kCM_BUTTON:
> ................
> case 100:
> fClient->FreePicture(pic);
> pic = fClient->GetPicture("home_t.xpm");
> fPictButton->DoRedraw();
> break;
>
> But the compilation will give the errors messages like:
>
> >>>> CC: error: cannot open message catalog: CC.cat
> >>>> CC: "oo.c", line 935: error: unknown message (1299)
> where line 935 is "fPictButton->DoRedraw();"

I don't know why you get this error message. However, what you want
is not implemented in the current version. I've added in the dev
version the option to set a new picture.

> (2). Is there any implementation in ROOT that make some warning sound like
> 'beep' function in UNIX ? It would be nice if the sound can continues
> till you switch it off.

To sound bell use gGXW->Bell(percent) where percent is the loudness
(-100<percent<=100).

> (3). Is the size of a TGPictureButton determined by that of the picture
> inside ? I did not find any implemtation that can resize the button.

The default size of a picture button is determined by the size of the
picture. If you want to resize a TGButton or a TGLabel you have to put them
in a container (e.g. TGCompositeFrame of fixed size (or desired size determined
by its container)) and add the button using a layout hint that forces the button
to be streched to the size of the container, like kLHintsExpandX. For an
example see $ROOTSYS/test/guitest.cxx line 752, where a fixed width container
is defined and line 775 where a layout hint is created and used by the
fTestButton, etc.

Cheers, Fons.

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910