Changing the bg color of a list item



Hi all.

I have managed to change the back color of a list item but it only stays
changed for about a millisecond. Then it turns white again. This is my
code can anyone tell me where I am going wrong?

TY

Ian

 if(SetPointValue < atoi( (char *)list->data ) ){

     char TempMess[1000];
     strcpy(TempMess, "");
     strcat(TempMess, CurrentTime);
     strcat(TempMess, " - ALARM:- ");
     strcat(TempMess, (char *)list->data );
     strcat(TempMess, " HAS REACHED SETPOINT LIMIT!!!!" );

    GdkColor color;
    GtkStyle * style;

    color.red = 65535;
    color.green = 0;
    color.blue = 0;

    GtkWidget * listitem = gtk_list_item_new_with_label ( TempMess );

    style = gtk_style_copy ( gtk_widget_get_style ( listitem ) );

    for ( int i = 0 ; i < 5 ; i ++ )
         style -> base[i] = color;

   gtk_container_add ( GTK_CONTAINER ( objects->xmllist ), listitem );
   gtk_widget_show ( listitem );

   gtk_widget_set_style (listitem, rc_style);

 }




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