How to have two or more ofxGui ?

Hi all,
i just sart using frameworks, and love it . thanks you all for this.

Right now i’m in dead end.

I’m using ofxGui, and i want to make 2 or more ofxGui, (ex :gui1 and gui2).

when i try desactivate on gui, the two GUI get desactivatid.

so if some can give me a help, i will be gratefull.

should i use only one gui, and use the comand to remove and add panels for make dinamcly the only one gui ?

Thanks,

Carlos Correia

Hi, Carlos. Take a look on the ofxGUI example. It has a method to change the active GUI linked to a slider, which gets different GUI configurations from XML files.

Hi AlexandreRangel,

Thanks for the tip, i was looking to the code, i have manage alrredy to create any number of GUI in the addon.

i Use this method :

I delete all panels(if any) , then i build the GUI i want.

Thanks,

Carlos Correia

Is there a way I can create a vector of ofxGui objects. I want to make an exanding gui that makes a number of identical panels in setup- I would like to draw the panels simultaneousy. Or maybe i ma looking for the wrong solution, I need to expand and contract the gui (only on setup).

I have tried this in .h

  
     
    vector<ofxFloatSlider*>  gainSliders;  
    vector<ofxFloatSlider*> shutterSliders;  
    vector<ofxFloatSlider*> gammaSliders;  
    vector<ofxFloatSlider*> brightnesSliders;  
    vector<ofxFloatSlider*> hueSliders;  
    vector<ofxIntSlider*> flickerSliders;  
    vector<ofxToggle*> autoSettingsOns;  
    vector<ofxPanel*> guis;  

and this in setup

  
  
for (int i = 0; i < deviceList.size(); i++) {  
        ofxGui * guis = new ofxGui();  
		ofxFloatSlider * gainSlider = new ofxFloatSlider();  
        ofxFloatSlider * shutterSlider = new ofxFloatSlider();  
        ofxFloatSlider * gammaSlider = new ofxFloatSlider();  
        ofxFloatSlider * brightnesSlider = new ofxFloatSlider();  
        ofxFloatSlider * hueSlider = new ofxFloatSlider();  
        ofxIntSlider * flickerSLider = new ofxIntSlider();  
        ofTexture * texture = new ofTexture();  
          
        gui->setup("PS3Eye");  
        gui->setPosition(660,20);  
          
        ofxToggle * autoGainAndShutter = new ofxToggle("Auto Gain & Shutter", false);  
        autoGainAndShutter->addListener(this, &testApp::onAutoGainAndShutterChange);  
        gui->add(autoGainAndShutter);  
          
        ofxFloatSlider * gain = new ofxFloatSlider("Gain", 0.5, 0.0, 1.0);  
        gain->addListener(this, &testApp::onGainChange);  
        gui->add(gain);  
          
        ofxFloatSlider * shutter = new ofxFloatSlider("Shutter", 0.5, 0.0, 1.0);  
        shutter->addListener(this, &testApp::onShutterChange);  
        gui->add(shutter);  
          
        ofxFloatSlider * gamma = new ofxFloatSlider("Gamma", 0.5, 0.0, 1.0);  
        gamma->addListener(this, &testApp::onGammaChange);  
        gui->add(gamma);  
          
        ofxFloatSlider * brightness = new ofxFloatSlider("Brightness", 0.5, 0.0, 1.0);  
        brightness->addListener(this, &testApp::onBrightnessChange);  
        gui->add(brightness);  
          
        ofxFloatSlider * contrast = new ofxFloatSlider("Contrast", 0.5, 0.0, 1.0);  
        contrast->addListener(this, &testApp::onContrastChange);  
        gui->add(contrast);  
          
        ofxFloatSlider * hue = new ofxFloatSlider("Hue", 0.5, 0.0, 1.0);  
        hue->addListener(this, &testApp::onHueChange);  
        gui->add(hue);  
          
        ofxIntSlider * flicker = new ofxIntSlider("Flicker Type", 0, 0, 2);  
        flicker->addListener(this, &testApp::onFlickerChange);  
        gui->add(flicker);  
          
        ofxIntSlider * wb = new ofxIntSlider("White Balance Mode", 4, 1, 4);  
        wb->addListener(this, &testApp::onFlickerChange);  
        gui->add(wb);  
          
        ofxToggle * led = new ofxToggle("LED", true);  
        led->addListener(this, &testApp::onLedChange);  
        gui->add(led);  
          
        // Load initial values  
        onAutoGainAndShutterChange(guigui->getToggle("Auto Gain & Shutter"));  
        onGainChange(gui->getFloatSlider("Gain"));  
        onShutterChange(gui->getFloatSlider("Shutter"));  
        onGammaChange(gui->getFloatSlider("Gamma"));  
        onBrightnessChange(gui->getFloatSlider("Brightness"));  
        onContrastChange(gui->vgetFloatSlider("Contrast"));  
        onHueChange(gui->getFloatSlider("Hue"));  
        onLedChange(gui->getToggle("LED"));  
        onFlickerChange(gui->getIntSlider("Flicker"));  
        onWhiteBalanceChange(gui->getIntSlider("White Balance"));  
          
        guis.push_back(gui);  
        gainSlider.push_back(gainSlider);  
        shutterSlider.push_back(shutterSlider);  
        gammaSlider.push_back(gammaSlider);  
        brightnesSlider.push_back(brightnesSlider);  
        hueSlider.push_back(hueSlider);  
        flickerSLider.push_back(flickerSLider);  
          
    }  

Maybe I am barking up the wrong tree

cheers

Well I fixed a lot of my stupid mistakes and got a little further.

With this

  
#pragma once  
  
#include "ofMain.h"  
#include "ofxMacamPs3Eye.h"  
#include "ofxSyphon.h"  
#include "ofxGui.h"  
  
class testApp : public ofBaseApp{  
public:  
    void setup();  
    void update();  
    void draw();  
      
    void keyPressed(int key);  
    void keyReleased(int key);  
    void mouseMoved(int x, int y);  
    void mouseDragged(int x, int y, int button);  
    void mousePressed(int x, int y, int button);  
    void mouseReleased(int x, int y, int button);  
    void windowResized(int w, int h);  
    void dragEvent(ofDragInfo dragInfo);  
    void gotMessage(ofMessage msg);  
    void onAutoGainAndShutterChange(bool & value);  
	void onGainChange(float & value);  
	void onShutterChange(float & value);  
	void onGammaChange(float & value);  
	void onBrightnessChange(float & value);  
	void onContrastChange(float & value);  
	void onHueChange(float & value);  
	void onLedChange(bool & value);  
	void onFlickerChange(int & value);  
	void onWhiteBalanceChange(int & value);  
      
    bool bHide;  
      
    int camWidth;  
    int camHeight;  
      
    vector<ofxMacamPs3Eye*> cameras;  
    vector<ofxSyphonServer*> servers;  
    vector<ofTexture*> textures;  
      
    vector<ofxFloatSlider*>  gainSliders;  
	vector<ofxFloatSlider*> shutterSliders;  
    vector<ofxFloatSlider*> gammaSliders;  
    vector<ofxFloatSlider*> brightnesSliders;  
    vector<ofxFloatSlider*> hueSliders;  
    vector<ofxIntSlider*> flickerSliders;  
	vector<ofxToggle*> autoSettingsOns;  
    vector<ofxPanel*> guis;  
      
};  
  

  
for (int i = 0; i < deviceList.size(); i++) {  
        ofxPanel * gui = new ofxPanel();  
		ofxFloatSlider * gainSlider = new ofxFloatSlider();  
        ofxFloatSlider * shutterSlider = new ofxFloatSlider();  
        ofxFloatSlider * gammaSlider = new ofxFloatSlider();  
        ofxFloatSlider * brightnesSlider = new ofxFloatSlider();  
        ofxFloatSlider * hueSlider = new ofxFloatSlider();  
        ofxIntSlider * flickerSLider = new ofxIntSlider();  
        ofTexture * texture = new ofTexture();  
          
        gui->setup("PS3Eye");  
        gui->setPosition(660,20);  
          
        ofxToggle * autoGainAndShutter = new ofxToggle("Auto Gain & Shutter", false);  
        autoGainAndShutter->addListener(this, &testApp::onAutoGainAndShutterChange);  
        gui->add(autoGainAndShutter);  
          
        ofxFloatSlider * gain = new ofxFloatSlider("Gain", 0.5, 0.0, 1.0);  
        gain->addListener(this, &testApp::onGainChange);  
        gui->add(gain);  
          
        ofxFloatSlider * shutter = new ofxFloatSlider("Shutter", 0.5, 0.0, 1.0);  
        shutter->addListener(this, &testApp::onShutterChange);  
        gui->add(shutter);  
          
        ofxFloatSlider * gamma = new ofxFloatSlider("Gamma", 0.5, 0.0, 1.0);  
        gamma->addListener(this, &testApp::onGammaChange);  
        gui->add(gamma);  
          
        ofxFloatSlider * brightness = new ofxFloatSlider("Brightness", 0.5, 0.0, 1.0);  
        brightness->addListener(this, &testApp::onBrightnessChange);  
        gui->add(brightness);  
          
        ofxFloatSlider * contrast = new ofxFloatSlider("Contrast", 0.5, 0.0, 1.0);  
        contrast->addListener(this, &testApp::onContrastChange);  
        gui->add(contrast);  
          
        ofxFloatSlider * hue = new ofxFloatSlider("Hue", 0.5, 0.0, 1.0);  
        hue->addListener(this, &testApp::onHueChange);  
        gui->add(hue);  
          
        ofxIntSlider * flicker = new ofxIntSlider("Flicker Type", 0, 0, 2);  
        flicker->addListener(this, &testApp::onFlickerChange);  
        gui->add(flicker);  
          
        ofxIntSlider * wb = new ofxIntSlider("White Balance Mode", 4, 1, 4);  
        wb->addListener(this, &testApp::onFlickerChange);  
        gui->add(wb);  
          
        ofxToggle * led = new ofxToggle("LED", true);  
        led->addListener(this, &testApp::onLedChange);  
        gui->add(led);  
          
        // Load initial values  
        onAutoGainAndShutterChange(gui->getToggle("Auto Gain & Shutter"));  
        onGainChange(gui->getFloatSlider("Gain"));  
        onShutterChange(gui->getFloatSlider("Shutter"));  
        onGammaChange(gui->getFloatSlider("Gamma"));  
        onBrightnessChange(gui->getFloatSlider("Brightness"));  
        onContrastChange(gui->getFloatSlider("Contrast"));  
        onHueChange(gui->getFloatSlider("Hue"));  
        onLedChange(gui->getToggle("LED"));  
        onFlickerChange(gui->getIntSlider("Flicker"));  
        onWhiteBalanceChange(gui->getIntSlider("White Balance"));  
          
        guis.push_back(gui);  
        gainSliders.push_back(gainSlider);  
        shutterSliders.push_back(shutterSlider);  
        gammaSliders.push_back(gammaSlider);  
        brightnesSliders.push_back(brightnesSlider);  
        hueSliders.push_back(hueSlider);  
        flickerSliders.push_back(flickerSLider);  
          
    }  
      

and I get this error which I dont really understand

  
  
Undefined symbols for architecture i386:  
  "testApp::onBrightnessChange(float&)", referenced from:  
      testApp::setup() in testApp.o  
      testApp::setup() in testApp.o  
  "testApp::onContrastChange(float&)", referenced from:  
      testApp::setup() in testApp.o  
      testApp::setup() in testApp.o  
  "testApp::onGainChange(float&)", referenced from:  
      testApp::setup() in testApp.o  
      testApp::setup() in testApp.o  
  "testApp::onFlickerChange(int&)", referenced from:  
      testApp::setup() in testApp.o  
      testApp::setup() in testApp.o  
  "testApp::onLedChange(bool&)", referenced from:  
      testApp::setup() in testApp.o  
      testApp::setup() in testApp.o  
  "testApp::onGammaChange(float&)", referenced from:  
      testApp::setup() in testApp.o  
      testApp::setup() in testApp.o  
  "testApp::onShutterChange(float&)", referenced from:  
      testApp::setup() in testApp.o  
      testApp::setup() in testApp.o  
  "testApp::onWhiteBalanceChange(int&)", referenced from:  
      testApp::setup() in testApp.o  
  "testApp::onHueChange(float&)", referenced from:  
      testApp::setup() in testApp.o  
      testApp::setup() in testApp.o  
  "testApp::onAutoGainAndShutterChange(bool&)", referenced from:  
      testApp::setup() in testApp.o  
      testApp::setup() in testApp.o  
ld: symbol(s) not found for architecture i386  
  

If anyone can give me a clue what this means.

Fred

I solved this in a much simpler way by switching to ofxSimpleGuiToo and using pages.