Re: CellRenderText properties question.



"Carl B. Constantine" wrote:

> ...Also, with GtkTreeViewColumn, you can bind a property to a value in a
> GtkTreeModel. For example, you can bind the "text" property on the cell
> renderer to a string value in the model, thus rendering a different string in
> each row of the GtkTreeView.
When you add a column to your view, you put ..., "text", COL, ... to
show the text from model column COL in the currently being added column.
The same is with "background" and "foreground" attributes, and the
pointed columns must contain a colour name (as string: "red", "blue",
etc).
 
> However, I can't really find any code examples of how to do anything
> suggested in these docs. For example, I have a GtkTextView that only has
> a single column in it. When I click a button in my window, I want to
> find out the current selection in that TreeView and set it's text to Red
> or Bold or something. I can't seem to find anything that shows how to
> get the exact cell and then change its attributes. I can do it globably
> for a column (and have for testing) but not on a single cell.
I posted an example a couple of days ago. Just a code snippet from one
of my projects, but should give you the idea.
You have to add a column for every attribute.

... If only it could be possible to map values to attributes (1=>"red",
2=>"blue" and so on...)

BYtE,
 Diego.



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