Re: How to use a signal



Jamiil Abduqadir wrote:
Hey again folks, continuing with the my previous posting about handling Entry boxes empty, I am using

Glib::SignalProxy1< bool,GdkEventFocus* > Gtk::Widget::signal_focus_out_event()

to check when the user leaves the box empty, but I am getting some errors at compile time, can anyone help!!??

namespace jve{
Entry{
      .......
      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::ptr_fun(&onBlank)); <== here is the problem
      ....
}

Your problem is that you should be using sigc::mem_fun(...) instead of sigc::ptr_fun(...). HTH.

-Jose

void jme::Entry::onBlank(){ // this->getText() returns a Gtk::ustring object
   if(this->getText(().empy()){
      // Display a Dialogbox explaining the problem
      text_box->grab_focus();
   }
}

D:\c++\entry.cpp||In member function `void jve::Entry::Entry()':|
D:\c++\entry.cpp|12|error: ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say `&jme::Entry::onBlank'| D:\c++\entry.cpp|12|error: no matching function for call to `ptr_fun(void (jve::Entry::*)())'|
||=== Build finished: 2 errors, 0 warnings ===|


Thanks in advance
--
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]