Windows and Widgets



When is a widget assigned a parent?  How do I know which widgets have
windows and which do not?  I have an array of labels for which I want to set
the background color to indicate status.  So, I have code similar to this
simple sample below.  Where there are ??? I have tried box and label both of
which failed.  Yes, I have looked at the tutorial and documentation.

Thanks in advance!
Mike

--------------------------------------------------------------------------

GtkWidget *box;
GtkWidget *label;
GtkWidget *parent;
GtkStyle *style;
GdkColor newColor;
gint i;

box = gtk_vbox_new (FALSE, 5);
label = gtk_label_new ("ClickHere");

gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 2);

parent = gtk_widget_get_parent_window (???);

style = gtk_style_copy (gtk_widget_get_style (parent));

newColor.red =255;
newColor.green = 0;
newColor.blue = 0;

for (i = 0; i < 5; i++)
{
   style->base[i] = &newColor;
}

gtk_widget_set_style (parent, style);








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