To: sacerdot at cs.unibo.it Cc: lablgtk at kaba.or.jp Subject: Re: GTree row selection event In-Reply-To: <20031107100532.GA17659 at cs.unibo.it> References: <20031107100532.GA17659 at cs.unibo.it> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20031110104118V.garrigue at kurims.kyoto-u.ac.jp> Date: Mon, 10 Nov 2003 10:41:18 +0900 From: Jacques Garrigue Lines: 35 From: Claudio Sacerdoti Coen > this question should probably be just a Gtk2 question. > I have a GTree that I use to render a table and I want to call a > call-back when a row is clicked, receiving also the ~event informations > to determine whether a single or double clicked occurred. > > #selection#set_selection_function is not useful: double-clicking on an already > selected row does not call the call-back twice (nor I have an event > object) Indeed, the documentation just says it is called when the state of a row has to be toggled. > #selection#connect#change does not give me the event object; moreover when > I call the selection#get_selected_rows to find the rows selected and > no row has been selected so far, I am told that the row 0 is selected > (???). And when I click on a row when no row is selected, I receive > two times the changed event! (and the first time I get the "row 0" false > answer) Have a look at examples/tree.ml. To see the new selection, you should use #selection#connect#after#changed. The rest of the behaviour is at it should be in `BROWSE mode. If you want to start from an empty selection, you should use `MULTIPLE mode. view#selection#set_mode `MULTIPLE > How I hate porting code from lablgtk to lablgkt2! The old tree widget is still available! The new tree widget is mostly interesting for multi-column trees. It replaces and improve the old ctree widget, which was not interfaced because it specification was broken. Jacques