Re: How to use a signal



Jamiil Abduqadir wrote:
Thanks Jose for your prompt response!
I have two questions regarding this issue,
One: what does HTH mean and

HTH = Hope This/That Helps

Second:
After doing the modifications your suggested, as shown below, I now get this 3 errors, please at the end of this message.

Please note, that this is the first time I am developing a GUI interface, I have chosen Gtkmm because it is C++, portable and fast, nevertheless, I might make stupid mistakes just because of my poor understanding of the GUI library, not because my lack of understanding of the OOP paradigm. As it is the case now, I am sure that I am not passing the right parameters expected by Gtkmm. However, according to

c:\doc\gtkmm-2.4/docs/tutorial/html/apb.html#id2567896

these, and as far as I understand, are the two parameters that I have to pass.

What am I doing wrong?

Thanks in advance.


================ code snip ========
namespace jve{
class Entry: virtual public Gtk::VBox {
      .......
      Gtk::Entry* text_box;
public:
      MyClass();
      .........
      void onBlanck();
};
}
jve::Entry::Entry(){
      ....
      text_box  = Gtk::manage(new Gtk::Entry());
*text_box->signal_focus_out_event().connect(sigc::mem_fun(*this, &Entry::onBlank)); /<== here is the problem/*
      ....
}
void jve::Entry::onBlank(){ // this->getText() returns a Gtk::ustring object
   if(this->getText(().empy()){
      // Display a Dialogbox explaining the problem
      text_box->grab_focus();
   }
}


It looks like your onBlank() method should be of type "bool" and not "void". In other words, it should return a bool value. See: http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1Widget.html#928afef862c529586ce0d461598623f1

=========== errors ===========
||=== Console application, default ===|
D:\XWin\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, jme::Entry>, T_return = bool, T_arg1 = GdkEventFocus*]'| D:\XWin\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, jme::Entry>, T_return = bool, T_arg1 = GdkEventFocus*]'| D:\XWin\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, jme::Entry>, T_return = bool, T_arg1 = GdkEventFocus*]'|
D:\c++\Samiira\entry.cpp|12|instantiated from here|
D:\XWin\include\sigc++-2.0\sigc++\functors\slot.h|136|error: void value not ignored as it ought to be| D:\XWin\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 = GdkEventFocus* const&, T_functor = sigc::bound_mem_functor0<void, jme::Entry>]':| D:\XWin\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::bound_mem_functor0<void, jme::Entry>, T_return = bool, T_arg1 = GdkEventFocus*]'| D:\XWin\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, jme::Entry>, T_return = bool, T_arg1 = GdkEventFocus*]'| D:\XWin\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, jme::Entry>, T_return = bool, T_arg1 = GdkEventFocus*]'| D:\XWin\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, jme::Entry>, T_return = bool, T_arg1 = GdkEventFocus*]'|
D:\c++\Samiira\entry.cpp|12|instantiated from here|
D:\XWin\include\sigc++-2.0\sigc++\adaptors\adaptor_trait.h|84|error: no match for call to `(sigc::bound_mem_functor0<void, jme::Entry>) (GdkEventFocus* const&)'| D:\XWin\include\sigc++-2.0\sigc++\functors\mem_fun.h|1787|note: candidates are: T_return sigc::bound_mem_functor0<T_return, T_obj>::operator()() const [with T_return = void, T_obj = jme::Entry]| D:\XWin\include\sigc++-2.0\sigc++\adaptors\adaptor_trait.h|84|error: return-statement with a value, in function returning 'void'|
||=== Build finished: 3 errors, 0 warnings ===|
--
Happiness has many doors, and when one of them closes another opens, yet we spent so much time looking at the one that is shut that we don't see the one that just opened.
------------------------------------------------------------------------

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


--
José Alburquerque
jaalburquerque cox net

The path to real wisdom begins with a deep loving respect for the ever living God (Prov. 1:7)



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