Re: [gtkmm] Gtk::TreeView on gtkmm



Susumu Yoshida wrote:
Hi all,

I am coding a software on glademm and gtkmm.
If there is someone with knowledge, I would like you to help me.
I got a problem when I tried to use a Gtk::TreeView.
I would like to code as below.
Suppose there is a TreeView like ...

item1 | item2 | item3 ---------------------------
entry11 | entry12 | entry13
entry21 | entry22 | entry23
entry31 | entry32 | entry33

I would like to distinguish between single-click and double-click.
When you single-click "entry11", for example , the first row should be just high-lit (not selected, nothing happens but being high-lit).
When you double-click "entry11", the first row should be selected
and some operation should be done.

What signal should I connect?
And what code should I add?

If you connect a signal handler to Gtk::TreeView::signal_row_activated() you will catch double-clicks on rows, and also the user pressing enter when a row is highlighted. Single click to highlight the row is built in behaviour in a Treeview.

The signal handler to connect to signal_row_activated should have a prototype like

void handler(const Gtk::TreeModel::Path &, Gtk::TreeViewColumn*)

The TreeModel::Path is a path to the row that was activated (use TreeModel::get_iter to get an iterator from that if you need one), and the TreeViewColumn is a pointer to the column which was activated (at least, I assume so, I've not had cause to use that particular functionality before).




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