ofAddListener / customEventExample / advancedEventsExample not working in 072. #1670

Closed
joernroeder opened this Issue Oct 30, 2012 · 3 comments

Comments

Projects
None yet
2 participants

Hi,
i'm trying to get the examples as well as the example code at http://www.slideshare.net/roxlu/openframeworks-007-events running. But it seems that the events won't be fired and onResultsUpdate will never called.

The following code snippets are my implementation of the CustomEventExample. ResultsUpdateEvent === GameEvent

void RequestHandler::setup() {
    ofAddListener(ResultsUpdateEvent::events, this, &RequestHandler::onResultsUpdate);
}

void RequestHandler::onResultsUpdate(ResultsUpdateEvent &e) {
    cout << "ResultsUpdateEvent: "+e.message << endl;
}
…
void RequestHandler::updateResults() {
    …

    static ResultsUpdateEvent newEvent;
    newEvent.message = "BUG HIT";

    cout << "fire event" << endl;
    cout << newEvent.message.c_str() << endl;

    ofNotifyEvent(ResultsUpdateEvent::events, newEvent);
}
Owner

bilderbuchi commented Oct 30, 2012

Thank you for your bug report!

I cannot reproduce your problem with the event examples - all examples in the event folder work correctly on my machine (Ubuntu).

It may be that you ran into a change to the events API in 0071, see the changelog:

ofEvents -> ofEvents() singleton - this means that projects which register calls using "ofEvents." will need to replace these with "ofEvents()." (note the parentheses).

Please report back if thsi was the solution.

Hey,
i downloaded the current 072 release from the of website and everything works fine now. I got the previous from github. so maybe there is something wrong.

Owner

bilderbuchi commented Oct 31, 2012

I also use a github version (the develop) branch. Also, current master should normally be functionally identical to the OF website download, so that should not make a difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment