Re: Background row color for a Gtk::TreeView



El 27 / novembre / 2009 00:15, José Alburquerque
<jaalburquerque cox net> ha escrit:
> On Thu, 2009-11-26 at 17:57 -0500, José Alburquerque wrote:
>> On Thu, 2009-11-26 at 14:01 +0100, Glus Xof wrote:
>> > Hello everyone,
>> >
>> > I have another question that I hope that would be enough difficult and
>> > elevated that will motivate everyone (who knows it, of course...) to
>> > reply me...
>> >
>> > I write a Gtk::TreeView with a bool type column. Like this,
>> >
>> > Gtk::TreeView m_indlist;
>> > m_indlist.append_column_editable("Select", m_Columns.m_col_select);
>> >
>> > That I would like is that the background row color remains in blue
>> > while the cell of the column "Select" is TRUE.
>>
>> Maybe by setting a slot to render the column's cell by using
>> Gtk::TreeViewColumn::set_cell_data_func().  In the handler, set one of
>> the Gtk::CellRenderer::property_cell_background() properties to the
>> color you want based on the value of the cell.
>
> I think the suggestion above is for just a cell.  For the whole row, you
> would probably have to add a slot to render cells to all the treeview's
> columns and check for the boolean in all the handlers.  There's probably
> a better solution.
>
> --
> José
>

Done. Thanks a lot.

The only problem I have now is to know how to change the text color of
these cells depending on the background color.

[Note: When I implemented the slot method, I used
Gtk::CellRenderer::property_cell_background_gdk() instead of
Gtk::CellRenderer::property_cell_background()]

Probably, there is an specific property defined... where is it ?

Glus.


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