Re: Highlighting text with color



Jeffrey Barish wrote:

I need to highlight some text in a TreeView.  I know how to change the
color, but I am wondering what color to use.  I am thinking that I should
choose a color that is used elsewhere so that the highlighted text does
not
clash with the theme, even if the user were to change the theme.  Perhaps
themes define a color to use for highlighting text.  Where would I find
information about the colors that are defined by themes?  How would I get
one of these colors from within my code?

I figured out that I can get the Style for the TreeView and then get the
color for text in whatever state (e.g., STATE_INSENSITIVE) I desire.  Then
I set the foreground-gdk property of the cell to that value and activate it
when desired by setting foreground-set to True.  This way I am using colors
from the palette of the theme.  Works great, except...

When I select the row, the text reverts to the default color.  Is there a
way to get the text to keep the color I assigned it before selecting the
row?  Or, to put it another way, how can I use set_cell_data_func of
TreeViewColumn to control the color of text in selected rows?
-- 
Jeffrey Barish




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