Re: Emitting and/or Catching a signal
- From: michi7x7 <mailing-lists michi7x7 de>
- To: gtkmm-list gnome org
- Subject: Re: Emitting and/or Catching a signal
- Date: Fri, 30 Apr 2010 20:16:16 +0200
Am 29.04.2010 22:52, schrieb Armin Burgmeier:
On Sat, 2010-03-27 at 21:43 -0400, ArbolOne wrote:
OS WinXP SP3
MinGW and MSYS= latest!
GCC
~~~~
Reading specs from D:/XWin/mingw/bin/../lib/gcc/mingw32/3.4.5/specs
Configured with: ../gcc-3.4.5/configure --with-gcc --with-gnu-ld
--with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw
--enable-threads --disable-nls --enable-languages=c,c
++,f77,ada,objc,java --disable-win32-registry --disable-shared
--enable-sjlj-exceptions --enable-libgcj --disable-java-awt
--without-x --enable-java-gc=boehm --disable-libgcj-debug
--enable-interpreter --enable-hash-synchronization
--enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.5 (mingw-vista special)
====================================================
OK, I give up!
I have been trying to emit a signal from one of my classes to another,
but it has proven to be beyond me. I am not an expert C++ programmer
let alone a GUI programmer, so bare with me please. Below is a snip of
the source code; since the class is so specific and at a such early
stage there aren't that many lines of code, nevertheless, my apology
for the use of the band-width; in the future I will try to post the
code on a URL site.
I would like to emphasize that any help and or observations are most
welcome as well as an observation
Now, the problem with my program is that when I tried to compile it it
tells me that there is an error in "...\include\sigc++-2.0\sigc
++\functor\stot.h in line 103
This is not very specific. Please always show the exact compiler error
message you get.
//// -- file.cpp SNIP ******
Menu::Menu() {
..........
//Command bar
RefActionGroup->add( Gtk::Action::create("MenuFile", "_File") );
RefActionGroup->add( Gtk::Action::create("New", Gtk::Stock::NEW,
"_New", "Create a new fle"), sigc::mem_fun(*this,&
Menu::onActionActivated));
..........
/******* THIS IS THE CODE CAUSING THE PROBLEM **************/
RefActionGroup->add( Gtk::Action::create("Quit",
Gtk::Stock::QUIT,"Quit", "Exit application"), sigc::mem_fun(*this,&
Menu::signal_quit));
.........
}
The function you provide here as a callback (Menu::signal_quit) needs to
match what RefActionGroup->add expects. According to the documentation
it needs to be a function returning void and taking no arguments. The
function you pass, Menu::signal_quit, does not return void though
(according to your code below).
I am not sure what this code is supposed to do. If you want to emit your
quit signal when the action is activated, then supply a custom function
as you do for your other action, and emit the signal in that function.
//// -- file.hpp SNIP ******
class Menu : virtual public Gtk::VBox {
public:
//signal accessor
typedef sigc::signal< my_enum::error_t> type_signal_end;
type_signal_end signal_quit();
protected:
type_signal_end m_signal_end1;
.........
private:
.........
}; //class
========================
// tester.hpp
class Tester : virtual public Gtk::Window {
public:
....
private:
Menu menu;
void quit(){this->hide();}
};
// tester.cpp
Tester::Tester(){
..............
///////////
menu.signal_quit().connect( sigc::mem_fun(*this,
&Tester::quit) );
///////////
................
}
Can any body help?
Armin
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
I finally reproduced my path through the sigc++-files. The proplem is
located here i think (or better there was my problem located):
#ifdef SIGC_GCC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD
#define SIGC_WORKAROUND_OPERATOR_PARENTHESES template operator()
#define SIGC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD
#else
#ifdef SIGC_MSVC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD
#define SIGC_WORKAROUND_OPERATOR_PARENTHESES operator()
#define SIGC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD
#else
#define SIGC_WORKAROUND_OPERATOR_PARENTHESES sun_forte_workaround
#endif
#endif
for some reason one of this defines was set wrong in sigc++config.h
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]