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

Julien Sobrier julien at sobrier.net
Tue Jul 4 20:05:26 EDT 2006


Brad Taylor wrote:
> Hi,
> 
>> Thank you
>> I don't see any row highlighted.
> 
> Maybe you're setting up the treeview/treestore incorrectly?  Its hard to
> say without seeing your code.  If it helps, I've attached a small
> example that shows how to properly set up a TreeView/TreeStore and
> demonstrates some simple selection operations.
> 
> If my example doesn't help, I would suggest pairing down your code to
> the smallest test case possible and attaching it to this discussion.
> 
> -Brad

Thank you for the help;

I finally found out that the problem is not in the Treeview but in the
focus:

TrackView tracks = new TrackView();
window.Add(tracks);
window.ShowAll();

This works fine (the first row is actually highlighted by default).
However, If I ever need to remove this widget,the first row is not
highlighted when I put it back:

TrackView tracks = new TrackView();
window.Add(tracks);
window.ShowAll();

window.Remove(tracks);
[... Dipslay something else ..]

window.Add(tracks);
window.ShowAll();
-> No highlight here

All I need to do is put back the focus on tracks:
tracks.IsFocus = true;

Julien


More information about the Gtk-sharp-list mailing list