0

I would like to highlight the first node of a GtkTreeView and give that node the focus. gtk_tree_view_row_activated () seems appropriate for what I am trying to do, but I couldn't figure out the arguments it takes.

Thanks in advance.

hckr
  • 5,456
  • 1
  • 20
  • 31

2 Answers2

0

gtk_tree_view_row_activated() actually acts on just one cell. I wonder if you really want to Highlight the row or just select it. I.e. if you want to leave the highlight even if the cursor is on another line.

If that's the case, note that you can define extra fields in the underlying model, for example, if you have 3 fields for your data, you can add field 4 with a color. Then you can tell the renderer to use the color in field 4 (instead of giving the renderer the color immediately).

This example not only changes the background, but also the text color: http://faq.pygtk.org/index.py?req=show&file=faq13.031.htp

For more sophisticated work, you can even modify the atributes on a cell-per-cell basis: http://www.pygtk.org/docs/pygtk/class-gtktreeviewcolumn.html#method-gtktreeviewcolumn--set-cell-data-func

jcoppens
  • 5,306
  • 6
  • 27
  • 47
0

Use set_cursor method:

TextView.set_cursor(0,None,False)

0 = Index of the first row

Saeid Amini
  • 1,313
  • 5
  • 16
  • 26
Rppsys
  • 1
  • 1