[Gtk-sharp-list] Advanced TreeView subclassing

László Monda mondalaci at gmail.com
Tue Oct 25 06:58:39 EDT 2005


I want to subclass TreeView in a special way.  What I want to do is
making its selection mechanism more usable in my application.

In my implementation one can select rows using the insert key and the
selected rows appear in a different (yellow) background color.  This
works well to this point, but here comes the advanced part.

I want the cursor change its color also according to whether its row
is selected or not selected.  I also want to use different colors when
it's active or inactive.  So it's 4 different possibilities.

I managed to solve this problem at some extent by connecting a handler
that uses Widget.ModifyBase(StateType, Gdk.Color) to
TreeView.CursorChanged.  The cursor changes its base color according
to the selected row, but there are the problems:

1) When I scroll with the keys fast, the content of the TreeView
flicks as hell.  The more row it has, the more it flicks.

2) When the TreeView becomes inactive, the cursor changes its color
back to the theme default, no matter what I set.

Thanks in advance.


    Blog: http://monda.hu/~laci/blog
    Home: http://mondalaci.objectis.net

More information about the Gtk-sharp-list mailing list