[gtkmm] Cannot connect callback for change of selection



Can somebody explain this compiler error to me?
I just cannot compile this:
m_TreeSelection->signal_changed().connect(SigC::slot(*this, &ConstraintTypesBrowser::selectedRowCallback));

g++ said:
/usr/include/sigc++-1.2/sigc++/object_slot.h: In constructor `
   SigC::ObjectSlotNode::ObjectSlotNode(void (*)(void*), T*, void*, T2) [with T
   = ConstraintTypesBrowser, T2 = void
   (ConstraintTypesBrowser::*)()]':
/usr/include/sigc++-1.2/sigc++/object_slot.h:73: instantiated from `SigC::Slot0<R> SigC::slot(O1&, R (O2::*)()) [with R = void, O1 = ConstraintManagementGui::ConstraintTypesBrowser, O2 = ConstraintManagementGui::ConstraintTypesBrowser]'
ConstraintTypesBrowser.cpp:129:   instantiated from here
/usr/include/sigc++-1.2/sigc++/object_slot.h:45: error: no matching function
   for call to `SigC::ObjectSlotNode::init(
   ConstraintTypesBrowser*&, void*&, void
   (SigC::Object::*&)())'
/usr/include/sigc++-1.2/sigc++/object_slot.h:46: error: candidates are: void
   SigC::ObjectSlotNode::init(SigC::Object*, void*, void (SigC::Object::*)())


.cpp
ConstraintTypesBrowser::ConstraintTypesBrowser(ConstraintGui &guiRef)
{
  ...
  // To find out what row the user has selected (single selection)
  m_TreeSelection = m_TreeView.get_selection();
  m_TreeSelection->set_mode(Gtk::SELECTION_SINGLE);

  // Connect callback for change of selection
  // line 129: Cannot compile this statement
  // ??????????????????????????????????????
  m_TreeSelection->signal_changed().connect(
		 SigC::slot(*this, &ConstraintTypesBrowser::selectedRowCallback));

  ...
}

void ConstraintTypesBrowser::selectedRowCallback()
{
  cout << "START selectedRowCallback()" << endl;

  Gtk::TreeModel::iterator iter = m_TreeSelection->get_selected();
  if (iter)
  {
	Gtk::TreeModel::Row row = *iter;

	// Get selected constraint name
	Glib::ustring selectedCName = row[m_Columns.m_col_cName];
	
	cout << "selected constraint is: " << selectedCName << endl;
  }
  cout << "END   selectedRowCallback()" << endl;
}




.h:
  class ConstraintTypesBrowser {

  public:
    ConstraintTypesBrowser(ConstraintGui &guiRef);

    virtual ~ConstraintTypesBrowser();


  protected:
	// Tree model columns:
	class ModelColumns : public Gtk::TreeModel::ColumnRecord
	{
	public:
	  ModelColumns()
	  {
		add(m_col_scope); // scope name
		add(m_col_cName); // constraint name
	  }
	  Gtk::TreeModelColumn<Glib::ustring> m_col_scope;
	  Gtk::TreeModelColumn<Glib::ustring> m_col_cName;
	};
	ModelColumns m_Columns;

	// Child widgets:
	Gtk::Frame m_Frame;
	Gtk::ScrolledWindow m_ScrolledWindow;
	Gtk::TreeView m_TreeView;
	Glib::RefPtr<Gtk::TreeStore> m_refTreeModel;
	Glib::RefPtr<Gtk::TreeSelection> m_TreeSelection;

	void selectedRowCallback();

  }; // class




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