RE: [gtk-list] Re: Toggle Button / Label Prob
- From: "Damon Chaplin" <DAChaplin email msn com>
- To: <gtk-list redhat com>
- Subject: RE: [gtk-list] Re: Toggle Button / Label Prob
- Date: Sun, 31 May 1998 12:19:32 +0100
> > I really can't work out how to set and change the caption on a toggle
> > button. I am trying to make a callendar widget for a PIM that I am
> > doing. (no others do the right things).
A toggle button is a subclass of button which is a container with one
child, which can be found with GTK_BUTTON(widget)->child;
So, if you know that this is a label, you can change it with:
gtk_label_set(GTK_LABEL(GTK_BUTTON(togglebutton)->child), "new label");
> But, the problem I've found is that the new label *appears* to be
> centred, where labels that are created with the checkbutton are left
> justified. I've tried using gtk_label_set_justify(label,
> GTK_JUSTIFY_LEFT) to fix this, but that doesn't work. 8(
I had trouble with this when I started learning GTK - I almost reported
it as a bug!
gtk_label_set_justify() is only relevant if a label has more than one line.
It sets the justification of the lines as a group, i.e. all the left edges/
middles/right edges lined up.
What you really wanted was the gtk_misc_set_alignment() function - a label
is a GtkMisc, which has an alignment and padding.
Left align:
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
Center align:
gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5);
Right align:
gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
Damon
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]