[9294] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] RE: dynamically changing a button's font

daemon@ATHENA.MIT.EDU (Damon Chaplin)
Wed Oct 14 13:51:52 1998

From: "Damon Chaplin" <DAChaplin@email.msn.com>
To: <gtk-list@redhat.com>
Date: Wed, 14 Oct 1998 18:55:30 +0100
In-Reply-To: <19981013165701.A5124@linux.ataman.com>
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com


> 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?
> 
> Dave

The text on a button is actually a child label widget,
so you have to set the style of that.
If you're using other widgets on the button as well, e.g. a pixmap,
its more difficult. You'd probably have to use a gtk_container_foreach
to recursively set the style of each widget in the hierarchy.

Maybe styles should really propagate down the widget tree, unless
a widget's style has already been set explicitly?
This is what I've been thinking of doing in Glade.

Damon


-- 
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post