Question

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?

Was it helpful?

Solution

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
    }
}    

OTHER TIPS

http://old.nabble.com/CellRenderer-editable-on-double-click-td24975510.html

self.treeview.connect("button-press-event",self.cell_clicked)

def cell_clicked(self, widget, event):
     if event.button == 1 and event.type == gtk.gdk.BUTTON_PRESS:
        print "Double clicked on cell"

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 .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top