views:

418

answers:

2

I'm trying to catch a double-click event in a TreeView's empty area to create a new node. Unfortunately standard way doesn't work. I've tried attaching ButtonPressEvent to both TreeView and the ScrolledWindow in which T.V. is hosted. I don't get any callbacks to my function.

How can I solve this?

A: 

I think the Treeview has a window of its own.

Get the window handle, and then SendMessage(treeview->Getsafehwnd() , tvi_root, tvichildren)

The above send message is for your understanding only .

Sujay Ghosh
Not sure which toolkit are you talking about, but it doesn't seem to be Gtk ;)
viraptor
No it's not GTK , its Windows programming. I believe that GTK shall have a similar thing.Toolkits are wrapper around the basics,. I believe.
Sujay Ghosh
+4  A: 

You'll need to use the GLib.ConnectBeforeAttribute on your handler to handle TreeView.ButtonPressEvent, otherwise the widget will handle the event internally and your handler won't be called.

example:

[GLib.ConnectBefore]
void OnTreeViewButtonPressEvent(object sender, ButtonPressEventArgs e)
{
    if (e.Type == Gdk.EventType.TwoButtonPress)
    {
        // double click
    }
}
anthony