Re: problem with connecting



 
Tralfas,

> random_button1.signal_clicked().connect(sigc::mem_fun(*this,
> &practice::on_button_clicked());
                            ^^^^^
should be:

random_button1.signal_clicked().connect (sigc::mem_fun(*this,
 &practice::on_button_clicked));
                            ^^^^ 

&practice::on_button_clicked is not a function call () here.

That should do it.

cheers
Chris

http://www.acurana.de/


Am Dienstag 16 Oktober 2007 15:06:36 schrieb Tralfas D:
> heres the code
> i get like a million errors but its the same error it doesnt like
> sigc::mem_fun
>
>
> 1>c:\documents and settings\donahueeli\my documents\visual studio
> 2005\projects\prac\prac\prac.cpp(28) : error C2780:
> 'sigc::const_mem_functor1<T_return,T_obj,T_arg1> sigc::mem_fun(T_return
> (__thiscall T_obj::* )(T_arg1) const)' : expects 1 arguments - 2 provided
>
> #ifndef GTKMM_PRACTICE_H
>
> #define GTKMM_PRACTICE_H
>
> #define WIN32_LEAN_AND_MEAN
>
> #include <gtkmm/window.h>
>
> #include <gtkmm/box.h>
>
> #include <gtkmm/button.h>
>
> #include <stdio.h>
>
> class practice : public Gtk::Window //inherit Gtk::window
>
> {
>
> public:
>
> practice(); //constructor
>
> ~practice(); //destructor
>
> private:
>
> void on_button_clicked(); //signal
>
> Gtk::Button random_button1, random_button2;
>
> Gtk::HBox box_of_holding, other_box;
>
> };
>
> #endif
>
>
>
>
>
> #include "stdafx.h"
>
>
>
>
>
> // practice.cpp : Defines the entry point for the console application.
>
> //
>
>
>
> #include <iostream>
>
>
>
> #include <gtkmm/main.h>
>
>
>
> using namespace std;
>
>
>
> practice::practice():
>
> random_button1("YES"),
>
> random_button2("NO")
>
> {
>
> set_title("Practice");
>
> add(box_of_holding);
>
> box_of_holding.pack_start(other_box);
>
> other_box.pack_start(random_button1);
>
> other_box.pack_start(random_button2);
>
> random_button1.signal_clicked().connect(sigc::mem_fun(*this,
>
> &practice::on_button_clicked());
>
>
>
> show_all_children();
>
> }
>
> practice::~practice()
>
> {}
>
> void practice::on_button_clicked()
>
> {
>
> exit(0);
>
> }
>
>
>
>
>
> int main(int argc, char* argv[])
>
> {
>
> Gtk::Main kit(argc, argv);
>
> practice prac;
>
> Gtk::Main::run(prac);
>
> return 0;
>
> }



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