[9117] in The GTK GIMP ToolKit mailing list archive
[gtk-list] RE: padding on buttons w/text
daemon@ATHENA.MIT.EDU (Damon Chaplin)
Fri Oct 9 04:22:07 1998
From: "Damon Chaplin" <DAChaplin@email.msn.com>
To: <gtk-list@redhat.com>
Date: Fri, 9 Oct 1998 09:26:38 +0100
In-Reply-To: <199810080948.JAA27341@dweezil.dyn.ml.org>
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com
> I'm an absolute beginner. Played around a little yesterday to get the
> hang of a few things, naturally doing "Hello world" and wondering why
> you can't apparently supply any padding between a button and its label
> when you use button_new_with_label. I tried using
> gtk_container_border_width with the button as container, but that puts
> the padding outside the button. Wound up writing my own little function
> for creating a button/label combination that provides padding by parking
> an hbox inside the button and putting the label inside the hbox. I'm
> not really bent out of shape about this (did it mostly as an exercise),
> but I'm wondering if there's an easy method I've missed, and/or if the
> extra widgets I used for my solution are for any reason a bad idea.
A GtkLabel is a subclass of GtkMisc, which has alignment and padding
properties. So I think you can do this:
button = gtk_button_new_with_label ("Hello World");
gtk_misc_set_padding (GTK_MISC (GTK_BUTTON (button)->child)), 20, 10);
Damon
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null