Re: TreeView and selecting rows




On Aug 17, 2004, at 5:47 AM, Torsten Schoenfeld wrote:

On Tue, 2004-08-17 at 07:06, Daniel Kasak wrote:

I have a treeview that I made quite some time ago.
Now I want to have rows selectable, and some code running on when
something is double-clicked.

The Gtk2::TreeView has a Gtk2::TreeSelection object that handles all
this stuff.  You can get to it via $view->get_selection.  You can then
set the selection mode with $selection->set_mode.  For the double click
part, connect to the row-activated signal of the view (in case you don't
do this already).

furthermore, a quick check of the gtk+ source reveals that the default selection mode is "single", so it should Just Work unless you're doing something like handling clicks and double-clicks with your own button-press-event handler which returns true (basically not allowing the built-in treeview stuff to run).

--
Examples really shouldn't include unexploded ordnance.
  -- Joe Smith, referring to an example program i wrote.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]