Connecting signals to widgets/windows



Hello,

I am writing a small C++ app, to be used as a informational counter
at a sporting event. It forks itself a few times, and 1 of the
processes will become the input window, and another will become
the display window. The display window takes its info from the
input window, through a pipe (which works fine). The only problem
is that the input window can also take an 'enter' key to signal to
the input window that a new runner has started.

I have a class OutputWindow (and a class InputWindow) to which a
signal is connected, starting a function external to the class,
which in its turn starts a function of the class itself. The problem
now is, that apparently the process locks up (and the display window
disappears) when the first function using the class's object-specific
variables gets called in response to the signal. Any cout called
before that first call (such as a message to console that the key
was pressed) work, both in the external function as in the class itself.
Anyone have a solution to this problem?

I am not that proficient in C/C++, so I do have a couple of questions:
Is there a way of connecting the signal directly to a function internal
to the class (can I connect OutputWindow::keyEnterPressed(...) directly?)

Short outline:

OutputWindow *__display;

void keyEnterPressedWrapper(...){
   __display->keyEnterPressed(...);
}

void OutputWindow::keyEnterPressed(...){
	//do the stuff.
}

GtkWidget *createOutputWindow(){
	//do everything that is needed to create and show the window,
	gtk_signal_connect(/*all the needed data*/)
}

In the inputwindow this strategy works fine (I did not write that myself...
just expanding it), the only difference is that there the variable is called
"__window".

Thanks!

Bart Van den Bosch
bvdb skynet be
bart vandenbosch student kuleuven ac be




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