GtkTreeView's row-activated and cursor-changed signals
I have a treeview and I am watching for the cursor-changed
and row-activated
signals. The problem is that in order to trigger the row-activate I fir开发者_运维百科st have to click on the row (triggering cursor-changed
) and then do the double click, requiring 3 clicks.
Is there a way to respond to both signals with 2 clicks?
It's not very clear what you're trying to achieve. I guess you're trying to respond to the user changing the selection in the treeview.
If this is the case, connect to the [changed][1]
signal on the gtk.TreeSelection
:
selection = treeview.get_selection()
selection.connect('changed', self.on_treeview_selection_changed)
As far as I can tell, this is not possible using the glade interface designer.
If, however, you are trying to do something else entirely, please add some more information.
The cursor-changed
signal is emitted even when single clicking on the same (selected) row. Still, the row-activated
signal is emitted when you double click on a row, whether it was selected before the double click or not. Thus you don't need 3 clicks to trigger a row-activated
.
As Jon mentioned, you want to connect to the selection's changed
signal in stead of cursor-changed
.
精彩评论