EventBox and bind combination
- From: Pete S <piotrek_sipika yahoo com>
- To: gtkmm-list gnome org
- Subject: EventBox and bind combination
- Date: Thu, 3 Feb 2005 13:41:05 -0800 (PST)
Hello,
I've been programming with gtkmm for a little while
and I really enjoy it. I was wondering if any of you
might have suggestions on how to overcome the
following hurdle:
I'm trying to pass a parameter into a on_button_press
function as follows:
<begin code>
m_EventBox.signal_button_press_event().connect(sigc::bind(sigc::mem_fun(*this,
&ExampleWindow::button_press), "testing") );
<end code>
with button_press() being defined as follows:
<begin code>
//eventbox.h file
class ExampleWindow {
...
bool button_press(GdkEventButton *e, char *t);
...
};
//eventbox.cc file
bool ExampleWindow::button_press(GdkEventButton*, char
*t);
{
cout<<t<<"\n";
return true;
}
<end code>
If I decide not to use sigc::bind and remove the char
*t from button_press(), it compiles and works fine,
but I need to know how to pass a parameter when the
EventBox press button signal is emitted.
Here's what the compilation output looks like:
<begin comp output>
$ make -f eventbox.mak
g++ -g `pkg-config gtkmm-2.4 --cflags --libs` -o
eventbox eventbox.cc eventboxmain.cc -L/usr/local/lib
-pthread
/usr/local/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:
In member function `typename
sigc::adaptor_functor<T_functor>::deduce_result_type<T_arg1,
T_arg2, void, void, void, void, void>::type
sigc::adaptor_functor<T_functor>::operator()(T_arg1,
T_arg2) const [with T_arg1 = GdkEventButton* const&,
T_arg2 = Glib::ustring&, T_functor =
sigc::bound_mem_functor2<bool, ExampleWindow,
GdkEventButton*, char*>]':
/usr/local/include/sigc++-2.0/sigc++/adaptors/bind.h:1121:
instantiated from `typename
sigc::bind_functor<-0x000000001, T_functor, T_type1,
sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil,
sigc::nil>::deduce_result_type<T_arg1, void, void,
void, void, void, void>::type
sigc::bind_functor<-0x000000001, T_functor, T_type1,
sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil,
sigc::nil>::operator()(T_arg1) [with T_arg1 =
GdkEventButton* const&, T_functor =
sigc::bound_mem_functor2<bool, ExampleWindow,
GdkEventButton*, char*>, T_type1 = Glib::ustring]'
/usr/local/include/sigc++-2.0/sigc++/functors/slot.h:136:
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::bind_functor<-0x000000001,
sigc::bound_mem_functor2<bool, ExampleWindow,
GdkEventButton*, char*>, Glib::ustring, sigc::nil,
sigc::nil, sigc::nil, sigc::nil, sigc::nil,
sigc::nil>, T_return = bool, T_arg1 =
GdkEventButton*]'
/usr/local/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::bind_functor<-0x000000001,
sigc::bound_mem_functor2<bool, ExampleWindow,
GdkEventButton*, char*>, Glib::ustring, sigc::nil,
sigc::nil, sigc::nil, sigc::nil, sigc::nil,
sigc::nil>, T_return = bool, T_arg1 =
GdkEventButton*]'
/usr/local/include/sigc++-2.0/sigc++/functors/slot.h:524:
instantiated from `sigc::slot1<T_return,
T_arg1>::slot1(const T_functor&) [with T_functor =
sigc::bind_functor<-0x000000001,
sigc::bound_mem_functor2<bool, ExampleWindow,
GdkEventButton*, char*>, Glib::ustring, sigc::nil,
sigc::nil, sigc::nil, sigc::nil, sigc::nil,
sigc::nil>, T_return = bool, T_arg1 =
GdkEventButton*]'
/usr/local/include/sigc++-2.0/sigc++/functors/slot.h:1129:
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::bind_functor<-0x000000001,
sigc::bound_mem_functor2<bool, ExampleWindow,
GdkEventButton*, char*>, Glib::ustring, sigc::nil,
sigc::nil, sigc::nil, sigc::nil, sigc::nil,
sigc::nil>, T_return = bool, T_arg1 =
GdkEventButton*]'
eventbox.cc:37: instantiated from here
/usr/local/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:103:
error: no match for call to
`(sigc::bound_mem_functor2<bool, ExampleWindow,
GdkEventButton*, char*>) (GdkEventButton* const&,
Glib::ustring&)'
/usr/local/include/sigc++-2.0/sigc++/functors/mem_fun.h:1897:
note: candidates are: T_return
sigc::bound_mem_functor2<T_return, T_obj, T_arg1,
T_arg2>::operator()(typename
sigc::type_trait<T_arg3>::take, typename
sigc::type_trait<T_arg4>::take) const [with T_return =
bool, T_obj = ExampleWindow, T_arg1 = GdkEventButton*,
T_arg2 = char*]
make: *** [eventbox] Error 1
<end comp output>
Sorry for the mess and thanks for any/all suggestions.
Pete
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]