[Gtk-sharp-list] Painting on the back of a TreeView

Iggy iggy.ma at gmail.com
Mon Jan 12 14:30:03 EST 2009


I wasn't aware that the TreeView had multiple GdkWindows but when I
changed it to BinWindow it worked perfect. Thanks! Heres the code for
anyone who's interested:

<code>
            this.ExposeEvent += delegate {
                if (((exTreeStore)myTreeView.Model).Count == 0) {
                    layout = new Pango.Layout(myTreeView.PangoContext);
                    layout.SetText("There are no results.");
                    layout.FontDescription =
Pango.FontDescription.FromString("Arial 10");

myTreeView.BinWindow.DrawLayout(myTreeView.Style.TextGC(StateType.Normal),
5, 5, layout);
                }
            };
</code>



On Mon, Jan 12, 2009 at 1:23 PM, Christian Hergert
<christian.hergert at gmail.com> wrote:
> On Mon, Jan 12, 2009 at 9:21 AM, Iggy <iggy.ma at gmail.com> wrote:
>> Id like to be able to paint some text on the back of a TreeView, so if
>> there are no entries it might say something like "No results" on the
>> treeview, but I can't figure out which code to use. I have tried
>> painting on the background using a Pango.Layout but it isn;t showing
>> up. I tried putting it in the Expose event and the Realized event.
>>
>> Does anybody know how to do this?
>
> You could probably do this with a dummy row.
>
> Are you aware that Gtk.TreeView has multiple GdkWindows?  The window
> for the row area i believe is the "BinWindow"
> (tree_view->priv->bin_window).
>
> -- Christian
>
>


More information about the Gtk-sharp-list mailing list