Re: TButton title

Rene Brun (Rene.Brun@cern.ch)
Tue, 16 Dec 1997 14:15:33 +0100


Laurent Aphecetche wrote:

> Hi again, and thanks for the fast answer on the previous question !
>
> I want to make a toggle button (i.e. a button which title change when you press it) but there is no TButton::SetTitle routine (but a TNamed one), so the "Text" primitive of TButton is not updated. Is there another way to do this ?
>

If you have an object TButton *button, then the procedure to update the text in the button
can be the following:
TText *btext = (TText*)button->GetListOfPrimitives()->First();
btext->SetTitle("New button title");
button->Modified();
button->Update();

Rene Brun