Created
April 23, 2014 12:26
-
-
Save acarabott/11213263 to your computer and use it in GitHub Desktop.
get value from ofxUIIntSlider guiEvent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ofApp::setup(){ | |
myValue = 5; | |
gui->addIntSlider("MY_INT_SLIDER", 0, 10, myValue); | |
} | |
void ofApp::guiEvent(ofxUIEventArgs &e) | |
{ | |
if (e.getName() == "MY_INT_SLIDER") | |
{ | |
// the trick is in the cast.... | |
ofxUIIntSlider *slider = (ofxUIIntSlider *) e.widget; | |
myValue slider->getValue(); | |
} | |
} | |
void ofApp::exit() | |
{ | |
gui->saveSettings("settings.xml"); | |
delete gui; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// irrelevant methods ommited | |
#pragma once | |
#include "ofMain.h" | |
#include "ofxUI.h" | |
class ofApp : public ofBaseApp{ | |
public: | |
void setup(); | |
void guiEvent(ofxUIEventArgs &e); | |
void exit(); | |
private: | |
int myValue; | |
ofxUICanvas *gui; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment