Re: begginer with C++



On 2/24/06, Carlos Garces <carlos garces gmail com> wrote:
> Thanks for your reply.
>
> onAbout callback is declared as void
>
> mpEventBox->signal_button_press_event().connect(sigc::mem_fun(*this,
> &MainWindow::onAbout));
> void MainWindow::onAbout()
> {
>         int result = mpAboutDialog->run();
>         mpAboutDialog->hide();
> }
>
> You can see the entire source there
> http://cvs.sourceforge.net/viewcvs.py/winpackman/WinPackManGTK/src/MainWindow.cpp?rev=1.2&view=log
> I can see what is wrong... this code is cut&paste  from there...
> http://cvs.sourceforge.net/viewcvs.py/dcatalyst/dcatalyst/clients/gcatalyst/MainWindow.cpp?rev=1.10&view=markup
> (I'm not a lammer, only a VB6 programmer)
>
> Un saludo
> Carlos Garcés
>
> >
> > void MainWindow::onAbout(GdkEventKey* ev);
> >
> > jason
> >
> > --
> > Jason Burchfield
> > CAS, Inc.
> > (256) 971-6096
> > Jason.Burchfield at cas-inc dot com
> >
> >
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>

It should return a bool.  The previous suggestions got it backwards
(except Jason, who got the return value correct the first time but
then changed his mind :) ).  The signature of
signal_button_press_event() is as follows:
Glib::SignalProxy1<bool,GdkEventButton*>
Gtk::Widget::signal_button_press_event()

If you look at the template arguments, they tell you what your
signal-handler function must look like.  The first argument specifies
the return value, and the remaining arguments specify the arguments
that are passed to the function.  So it would look like this:
bool MainWindow::onAbout(GdkEventButton* ev);

(note that your original function took an argument of GdkEventKey*,
but it should be GdkEventButton*)

Jonner



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