Re: [gtkmm] TreeView: number of clicked column



> > A good way to do that is to create an object inheriting from
> > Gtk::TreeViewColumn and that will keep the column number and connect
> > to signal_clicked(). Then it can catch the click signal and pass it
> > with the column number to my general function.
> > 
> > Is there another quicker way to to that?
> 
> You can do funky stuff with SigC::bind and pointers. Perhaps it can
> help here. For example:

Thanks a lot!

Here's the result in this case:

void MyClass::column_clicked(int colnb) {
     // process column click depending on the column number
}

MyClass::MyClass() {
     // ...

     treeview.get_column(0)->signal_clicked().connect(SigC::bind<int>
(SigC::slot(*this, &ConnectRoomWindow::column_clicked), 0));
     treeview.get_column(1)->signal_clicked().connect(SigC::bind<int>
(SigC::slot(*this, &ConnectRoomWindow::column_clicked), 1));
     treeview.get_column(2)->signal_clicked().connect(SigC::bind<int>
(SigC::slot(*this, &ConnectRoomWindow::column_clicked), 2));

     // ...
}





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