On Mon, 2006-04-10 at 16:09 +0200, Alfons Adriaensen wrote: > On Mon, Apr 10, 2006 at 03:11:49PM +0200, Julien Claassen wrote: > > Hi all! > > I know it's completely OT, but I think there maybe people here, who could > > help me. > > Problem is: I'm still on my libcui (character user interface) project and > > I > > wonder: > > I push a button, slide a slider... How does the UI notify the program of > > this change? How do Engine and UI communicate? > > Please anyone: HELP ME! > > Hello Julien, > > This is a tricky subject, and most toolkits have their own peculiar > methods of solving the problem. > > In general terms this needs callback functions - a function supplied > as a creation parameter to the widget, and which it will call when > it has something to report. > > In C this is quite easy to arrange. The widget is given a function > pointer, and usually also a void* which becomes the first argument > of the callback fucntion and points to any context the receiver wants > to be available when called back. Other arguments depend on what the > callback needs to report. > > In C++ you will want class function members to act as callbacks, and > here things get complicated. Since callback functions are strongly > typed and this type depends on the class they are in, there is no single > variable type you can put into the widget to hold the function pointer.
If you want this in C++, you definitely want to use libsigc++. (Keyword definitely) -DR-