[gtkmm] Passing widgets



Hi,

I want to know how do I pass a GtkEntry widget on click of a button. I have a
callback function on click of a button. In that function, I want to access the
text of a GtkEntry widget.
My code is:

------------------------------------------------------------
void window1::on_okbutton_clicked(GtkEntry *entry1)
{
    g_print(entry1.get_text());
}
------------------------------------------------------------

"entry1" is the name of the "GtkEntry" widget.

When I try to compile the above code, it gives me the following error:

------------------------------------------------------------
window1_glade.cc: In constructor `window1_glade::window1_glade()':
window1_glade.cc:94: error: no matching function for call to `
   Glib::SignalProxy0<void>::connect(SigC::Slot1<void, _GtkEntry>)'
/usr/include/gtkmm-2.0/glibmm/signalproxy.h:113: error: candidates are: 
   SigC::Connection Glib::SignalProxy0<R>::connect(const SigC::Slot0<R>&, bool) 
   [with R = void]
/usr/include/sigc++-1.2/sigc++/object_slot.h: In static member function `static 
   typename SigC::Trait<T>::type SigC::ObjectSlot1_<R, P1, Obj>::proxy(typename 
   SigC::Trait<P1>::ref, void*) [with R = void, P1 = _GtkEntry, Obj = 
   window1_glade]':
/usr/include/sigc++-1.2/sigc++/object_slot.h:111:   instantiated from
`SigC::Slot1<R, P1> SigC::slot(O1&, R (O2::*)(P1)) [with R = void, P1 =
_GtkEntry, O1 = window1_glade, O2 = window1_glade]'
window1_glade.cc:94:   instantiated from here
/usr/include/sigc++-1.2/sigc++/object_slot.h:100: error: parameter type of 
   called function is incomplete
/usr/include/sigc++-1.2/sigc++/object_slot.h:100: confused by earlier errors,
bailing out
make: *** [window1_glade.o] Error 1
------------------------------------------------------------


I would also like to know if there is some complete tutorial available for GTKMM.

Regards,
Vishal Kothari.



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