Re: change text in button



Hi,

CAVEY GERARD <GERARD CAVEY sgam com> writes:

> Objet : change text in button
> I can not change the color of the text (only when I click on the 
> butten..the 'markes' that the button is selected are 'red' then.)
> How could I reach the label in the butten in order to change the color? 
> something like this button->label ?
> Or maybe I need to create a new label, and 'give them the color and pack 
> it' again into the button?
> @@@@@@@@@@@@@@@@@@
> hi
> in fact the label of a button is stored in the menber child of the button 
> so u can simply refer to it
> consider the folowing
> label = (GtkLabel*) GTK_BUTTON(MyButton)->child;

that won't work since the GtkButton struct doesn't have a child member.
In fact a GtkButton is a GtkBin which is a special container with just
one child. So to access the label you should use

 label = GTK_LABEL (GTK_BIN (button)->child);


Salut, Sven



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]