[gtkmm] Keyboard/Mouse signals on a TreeView?



Hi folks,

I'm trying to add signal handlers to a TreeView to trigger editing of a line by
double-click or ENTER. However, the TreeView seems to ignore my signals.
Currently, my code looks like this:

  DefaultCustomerListView::DefaultCustomerListView () {
    // ... [some constructor stuff]
    dataTree.signal_key_press_event () .connect (
      SigC::slot ( *this, &DefaultCustomerListView::_key_pressed ) );
    dataTree.signal_button_press_event () .connect (
      SigC::slot ( *this, &DefaultCustomerListView::_button_pressed ) );
  } // DefaultCustomerListView::DefaultCustomerListView

  bool DefaultCustomerListView::_key_pressed ( GdkEventKey *event ) {
    switch ( event -> keyval ) {
      case GDK_KP_Insert: do_createCustomer (); break;
      case GDK_KP_Enter: do_editCustomer (); break;
      case GDK_KP_Delete: do_deleteCustomer (); break;
    } // switch
  } // DefaultCustomerListView::_key_pressed

  bool DefaultCustomerListView::_button_pressed ( GdkEventButton *event ) {
    switch ( event -> type ) {
      case GDK_2BUTTON_PRESS: do_editCustomer (); break;
    } // switch
  } // DefaultCustomerListView::_button_pressed

What am I doing wrong?

Thanks in advance,

  Markus



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