Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Can't Add Listener to ofxToggle

$
0
0

@IanMcD wrote:

I’m getting an error “Can’t Add Listener to ofxToggle” when I try and add an event listener to a toggle in setup. Works fine if the I use buttons instead of toggles. What am I missing? Thanks!

cpp File

void ofApp::setup(){
    ...
    myToggle.addListener(this, &ofApp::toggleBtnPressed);
    guiProperties.setup("Properties", "Properties", 10, 60);
    guiProperties.add(myToggle.setup("myToggle", false));
    ...
}
void ofApp::exit(){
    myToggle.removeListener(this, &ofApp::toggleBtnPressed);
}

void ofApp::toggleBtnPressed(){
    myFunc();
}


Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles