dispacthing custom events with or without poco

how can i use poco or another library to dispatch custom events? im uncertain how the event handling with poco function. i have read through http://www.openframeworks.cc/forum/view-…-t&start=15 a didnt see anything about dispatching custom events. i want to make some custom events for when a movie is through playing. i am used to programming in as and java so for me it is difficult.

hey ekene.

you can see an example in this intro to the poco library (first code listing):

http://www.appinf.com/docs/poco/GuidedTour.html

and a deeper explanation here:

http://www.appinf.com/poco/wiki/tiki-in-…-page=Event

also some days ago I coded a small class that makes an http request on a thread (using ofxThread, not poco) and gives back the result on a poco event.

http://jesusgollonet.com/openFrameworks-…-craper.zip

basically, if you want to dispatch events from one class (Source) to another (Target), you have to

In Source

  • Create a poco BasicEvent, specifying the datatype that you want to pass on the event
  
  
BasicEvent<string> responseReady;  
  

  • Create a dispatch method
  
  
void dispatchResponse (string response) {  
     responseReady.notify(this, response);  
}  
  

In Target

  • Create the receiver method
  
  
void onResponseReceived(const void* pSender, string& response) {  
     cout << "response -" << endl;  
     cout << response    << endl;  
}  
  

  • Subscribe to the source event using Delegate
  
  
sws.responseReady+= Delegate<testApp, string>(this, &testApp::onResponseReceived);  
  

hope that helps.

Best!
jesús

thanks jesus the poco events are great!