Reputation: 34145
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?
Upvotes: 4
Views: 3908
Reputation: 21
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"
Upvotes: 2
Reputation: 41088
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
}
}
Upvotes: 8
Reputation: 2868
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 .
Upvotes: -4