Re: Background color of Treeviews with just few rows



Hi Juan,

have you tried the proposed code to verify that if works or not, or just guessing?

I use that code (plus your code, but it doesn't work on its own) in my own program, and it works fine.
Note that the same color is set for odd and even color.

You can download my program NoteCase Pro (www.notecasepro.com) and use "General Settings" window (page "03 Display", select color for "Color" -> "Background" entry) to change the color of the tree view found on the left of the main window.

Regards,
  Miroslav

On 30.9.2015. 20:54, Juan L. Freniche wrote:
Thanks. However I think your recommendation will draw odd and even row with the selected color but this is not what I am looking for.

I would like to give some color to the area below last row, in a treeview with a small number of rows. This area is by default white.

El 30/09/2015 a las 12:45, Miroslav Rajcic escribió:
This code works for me for GTK 2.x:

static const char color_rc[] =
                "style \"aaa\"\n"
                "{\n"
                "GtkTreeView::odd-row-color=\"#%04x%04x%04x\"\n"
                "GtkTreeView::even-row-color =\"#%04x%04x%04x\"\n"
                "}\n"
                "widget \"*.aaa\" style \"aaa\"";  // removed "class \"GtkTreeView\"" because it would change all trees

            gchar *rc_temp = g_strdup_printf(color_rc,
                color.red,
                color.green,
                color.blue,
                color.red,
                color.green,
                color.blue);
            gtk_rc_parse_string(rc_temp);
            gtk_widget_set_name(widget, "aaa");
            gtk_widget_reset_rc_styles(widget);
            g_free(rc_temp);

I hope it helps.

Regards,
  Miroslav
On 30.9.2015. 8:51, Juan L. Freniche wrote:
Hello, I would appreciate help in this topic:

I have a notebook with several pages. Every page has a scrolledwindow and then a treeview.

For treeviews with sufficient rows, no problema but if the treeview has a small number of rows, the remaining area below the last row is in white color.

I would like to change the color of this area. I tried

style =get_style (widget)
set_background (style, state_normal, other color)
set_style (widget, style)


where widget was sucessively the notebook, the scrolled window and the treeview. No success.

I am using Gtk 2.24 and in the process of moving to Gtk3.

Thanks in advance.

_______________________________________________
gtk-list mailing list
gtk-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-list



_______________________________________________
gtk-list mailing list
gtk-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-list



_______________________________________________
gtk-list mailing list
gtk-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-list



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