Gtk::Entry and signal_key_press_event



Dear all,

I have a very simple to describe problem with gtkmm 2.4.  I have a
small window using a Gtk::Entry:

class NewWorldWin : public Gtk::Window
{
  ...
  Gtk::Entry name_entry;
};

And I am trying to be notified of users typing in that entry, hence in
the implementation I have added:

NewWorldWin::NewWorldWin(void)
{
  ...

  name_entry.
    signal_key_press_event().
    connect(sigc::mem_fun(*this, &NewWorldWin::some_handler));
}

However, I cannot get it past the compiler.  Here's the error I am
getting, which, unfortunately, does not point at my code but at the
internals of libsigc++.  I am a bit lost, how to interpret it.

/usr/include/sigc++-2.0/sigc++/functors/slot.h: In static member function `static T_return sigc::internal::slot_call1<T_functor, T_return, T_arg1>::call_it(sigc::internal::slot_rep*, typename sigc::type_trait<T_arg3>::take) [with T_functor = sigc::bound_mem_functor0<void, NewWorldWin>, T_return = bool, T_arg1 = GdkEventKey*]':
/usr/include/sigc++-2.0/sigc++/functors/slot.h:144:   instantiated from `static void* (* sigc::internal::slot_call1<T_functor, T_return, T_arg1>::address())(void*) [with T_functor = sigc::bound_mem_functor0<void, NewWorldWin>, T_return = bool, T_arg1 = GdkEventKey*]'
/usr/include/sigc++-2.0/sigc++/functors/slot.h:529:   instantiated from `sigc::slot1<T_return, T_arg1>::slot1(const T_functor&) [with T_functor = sigc::bound_mem_functor0<void, NewWorldWin>, T_return = bool, T_arg1 = GdkEventKey*]'
/usr/include/sigc++-2.0/sigc++/functors/slot.h:1157:   instantiated from `sigc::slot<T_return, T_arg1, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>::slot(const T_functor&) [with T_functor = sigc::bound_mem_functor0<void, NewWorldWin>, T_return = bool, T_arg1 = GdkEventKey*]'
newworldwin.cc:58:   instantiated from here
/usr/include/sigc++-2.0/sigc++/functors/slot.h:137: error: void value not ignored as it ought to be
/usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h: In member function `typename sigc::adaptor_functor<T_functor>::deduce_result_type<T_arg1, void, void, void, void, void, void>::type sigc::adaptor_functor<T_functor>::operator()(T_arg1) const [with T_arg1 = GdkEventKey* const&, T_functor = sigc::bound_mem_functor0<void, NewWorldWin>]':
/usr/include/sigc++-2.0/sigc++/functors/slot.h:137:   instantiated from `static T_return sigc::internal::slot_call1<T_functor, T_return, T_arg1>::call_it(sigc::internal::slot_rep*, typename sigc::type_trait<T_arg3>::take) [with T_functor = sigc::bound_mem_functor0<void, NewWorldWin>, T_return = bool, T_arg1 = GdkEventKey*]'
/usr/include/sigc++-2.0/sigc++/functors/slot.h:144:   instantiated from `static void* (* sigc::internal::slot_call1<T_functor, T_return, T_arg1>::address())(void*) [with T_functor = sigc::bound_mem_functor0<void, NewWorldWin>, T_return = bool, T_arg1 = GdkEventKey*]'
/usr/include/sigc++-2.0/sigc++/functors/slot.h:529:   instantiated from `sigc::slot1<T_return, T_arg1>::slot1(const T_functor&) [with T_functor = sigc::bound_mem_functor0<void, NewWorldWin>, T_return = bool, T_arg1 = GdkEventKey*]'
/usr/include/sigc++-2.0/sigc++/functors/slot.h:1157:   instantiated from `sigc::slot<T_return, T_arg1, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>::slot(const T_functor&) [with T_functor = sigc::bound_mem_functor0<void, NewWorldWin>, T_return = bool, T_arg1 = GdkEventKey*]'
newworldwin.cc:58:   instantiated from here
/usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:84: error: no match for call to `(sigc::bound_mem_functor0<void, NewWorldWin>) (GdkEventKey* const&)'
/usr/include/sigc++-2.0/sigc++/functors/mem_fun.h:1786: note: candidates are: T_return sigc::bound_mem_functor0<T_return, T_obj>::operator()() const [with T_return = void, T_obj = NewWorldWin]
/usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:84: error: return-statement with a value, in function returning 'void'
make: *** [all] Error 1

Any pointers on what I am doing wrong?  I feel, I am missing something
obvious, but not obvious enough such that the compiler would complain
about MY code.

By the way, I have also tried to inherit from Gtk::Entry and override
on_key_press_event, which works fine but then I cannot access the data
of my window, and my design becomes generally 'ugly'.  So I'd like to
somehow have access to that signal inside the window rather than write
my own Entry-derivate, and split off a dedicated data class.

Many thanks for any help in advance,

Andreas.


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