Can't Add Listener to ofxToggle

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(){

The listener for the ofxToggle should have an argument, like:

void ofApp::toggleBtnPressed(bool & value){



1 Like

Magical! Thank you so much :smiley: