[Gtk-sharp-list] How to highlight the first

Julien Sobrier julien at sobrier.net
Mon Jul 3 23:12:44 EDT 2006


Brad Taylor wrote:
> Hey,
> 
>> I'm trying to highlight the first row of a TreeView. I tried several
>> variations around this ode, but none of them has any effect:
> 
> Probably the best way to do this is the following:
> 
> TreeIter iter;
> if (your_model.GetIterFirst (out iter)) {
> 	your_treeview.Selection.SelectIter (iter);
> }
> 
> This allows for the case when there is no first iter (empty model).  It
> will also work in the TreeStore and ListStore case.
> 
> Hope this helps.
> 
> -Brad

Thank you
I don't see any row highlighted. I've checked that the treeview is not
empty when I use the code:
log4net.Info("number of rows highlighted: " +
this.Selection.CountSelectedRows() -> 1
this.Model.IterNChildren() -> 3

If I click on the first item, or if I push the bottom arrow key, then
the first row is highlighted.

I've also tried to highlight all the rows:
this.Selection.Mode = SelectionMode.Multiple;
this.Selection.SelectAll();

The value of this.Selection.CountSelectedRows() is 3, but I still don't
see any highlight!

Julien


More information about the Gtk-sharp-list mailing list