Re: [gtk-list] Toggle Button / Label Prob



Lawrence Sim wrote:

> 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).

Don't know if this has been answered yet, but since I just figured it
out, thought I'd answer one question instead of asking (but wait, ?'s
yet to come 8))

Here's how I'm changing label's on a checkbutton, which is essentially a
toggle button.

// Get ALL the ONE label in the button
list = gtk_container_children(GTK_CONTAINER(checkbox));
// Remove the ONE label from the button
gtk_container_remove(GTK_CONTAINER(checkbox), GTK_WIDGET(list->data));
// Create a new label (the text to be inserted
// into the button
label = gtk_label_new(str);
// Make sure the label can be seen 8)
gtk_widget_show(label);
// Add the label to the button
gtk_container_add(GTK_CONTAINER(checkbox), label);

I've used this successfully on both button's and checkbuttons. It should
work for toggle buttons too.

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(

Doug
-- 
My wasted space --- http://www.squirrel.net/~dsouth




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