[pygtk] Problem with GtkTreeView
Greg Bair
gregbair at gmail.com
Tue Aug 31 21:48:45 WST 2010
On 08/31/2010 08:34 AM, Andreas Heinlein wrote:
> Hello,
>
> I have a problem with a GtkTreeView in one of my apps, and I hope you
> can help me.
>
> I have a window containing a a GtkTreeView and displaying a list, backed
> by a GtkListStore if that matters. The TreeView contains four columns,
> the first one contains a GtkCellRendererToggleButton, the other ones
> each a GtkCellRendererText.
>
> I put the initial focus on the TreeView and can navigate the list up and
> down with arrow keys and toggle the button in each row with space. But
> if I click on the text in one of the rows, the row is highlighted, and
> the text is focussed, i.e. there is a thin dotted frame around it.
> Pressing space now does not toggle the button, only if you move the
> focus back to the toggle button using e.g. left arrow it will work again.
>
> What I want is to mimic windows behaviour, i.e. clicking anywhere on a
> row and pressing space toggles the button, no matter where exactly you
> click.
>
> Any way to accomplish this?
>
> Thanks,
> Andreas
You can connect a signal to the treeview. It has a signal of
"row-activated"[1] which is emitted when a row is highlighted and user
hits space (or one of the other keys listed in the docs). You could
then use this to toggle the button.
[1]http://www.pygtk.org/docs/pygtk/class-gtktreeview.html#signal-gtktreeview--row-activated
More information about the pygtk
mailing list