Re: Single and double clicks on a row in treeview (gtkmm 2)



As you already know, calling TreeView::set_activate_on_single_click( false ) and connecting to TreeView::signal_row_activated() allows you to intercept a double click. To intercept a single click, get the TreeSelection object associated with the TreeView using TreeView::get_selection() and connect to TreeSelection::signal_changed(). Be aware that a single click on a row that's already selected will not emit signal_changed(). Also, there's a warning somewhere in the documentation that says you may occasionally receive signal_changed() when in fact there has NOT been a change in the selection.

If that doesn't do what you need, you can also intercept and handle clicks at a much more basic level with TreeView::signal_button_press_event(). There's an example at https://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/treeview/popup that will get you started in that direction.

On 2016/07/05 03:44, Kamalpreet Grewal wrote:
Hi

I am working on a software that has been developed using gtkmm 2. I
have been working on a treeview. I wish to implement two different
actions on single and double click on rows of this treeview.

The property "activate-on-single-click" is available in gtkmm 3. Else
this property could have been used for both type of clicks.
signal_row_activated() is emitted when the user double clicks a
treeview row.

How can I achieve both type of clicks for the treeview?



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