Hi,
Another challenge for you guys !
I designed an interface to control video projectors. This interface is made of :
- one master canvas which commands selected projectors.
- multiple canvas (one per projector) with personal commands for each projector itself.
Here is my problem :
In my master canvas i have, among others, one button to select all projectors and another one to unselect them.
Let’s say i have an interface controling 3 projectors (i.e. 1 master canvas + 3 command interfaces)
When i click “SELECT ALL” every LabelButton state for each command canvas have to be set to “true”.
When i click “SELECT ALL” every LabelButton state for each command canvas have to be set to “false”.
Some info :
Projectors : vector of ofxPJCtrl
Master canvas : ofxUICanvas
command GUIs : vector of ofxUICanvas
vector<ofxPJCtrl *> projectors;
ofxUICanvas *masterGUI;
vector<ofxUICanvas *> commandGUI;
Excerpt of my ofxPJCtrl.h :
class ofxPJCtrl {
public :
ofxPJCtrl();
~ofxPJCtrl();
...
bool isSelected();
string getProjectorName();
...
private :
...
bool selected;
string projectorName;
...
};
in my testApp.cpp these lines add widgets in master GUI :
masterGUI->addSpacer();
masterGUI->addLabelButton("SELECT ALL", false);
masterGUI->addLabelButton("SELECT NONE", false);
masterGUI->addSpacer();
in my testApp.cpp this line adds label toggle in each command canvas which is used to select the projector :
gui->addToggle(proj->getProjectorName(), false, 16, 16);
...
commandGUI.push_back(gui);
This is my attempt to set every “select” button of command guis :
else if(e.widget->getName() == "SELECT ALL")
{
vector<ofxUICanvas *>::iterator it;
for(it = commandGUI.begin(); it != commandGUI.end(); it++)
{
(*it)->e.widget->getName() == (*it)->getProjectorName();
ofxUILabelButton *btn = (ofxUILabelButton *) e.widget;
(*it)->btn->setValue(true);
}
}
I can’t figure out how to retrieve each select button ID to set their value to true or false.
I hope you have enough information to help me. If not, don’t hesitate to ask me more.
Attached, a screenshot to make it a bit easier to understand…
Thanks a lot
