[9291] in The GTK GIMP ToolKit mailing list archive
[gtk-list] Re: dynamically changing a button's font
daemon@ATHENA.MIT.EDU (Owen Taylor)
Wed Oct 14 10:25:54 1998
To: gtk-list@redhat.com
From: Owen Taylor <otaylor@redhat.com>
Date: 14 Oct 1998 10:36:32 -0400
In-Reply-To: beach@ataman.com's message of "Tue, 13 Oct 1998 16:57:01 -0600"
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com
beach@ataman.com writes:
> I've been working on some gtk code which quite frequently needs to
> change the style used by some of the controls on the screen. When
> dealing with a label, I've had much success with something like:
>
> label.set_style(new_style);
>
> (where new_style is set to use a different font than the label's
> former style.)
>
> However the same code doesn't seem to work at all when I use it with a
> button. I read the styles.txt and it seems to indicate to me that my
> code should be working. Any ideas?
Try that on:
GTK_LABEL (GTK_BIN (button)->child)
(or GTK_BUTTON (button)->child if you want the code to be compilable
on 1.0.x)
A button is just a container with a child. gtk_button_new_with_label()
is a convience function that creates the child label automatically.
Regards,
Owen
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null