Closed nanu-c closed 8 years ago
Thanks for reporting this issue! I can't find a simple way to fix the matrix issue but it does at least work if you use ofxGuiGroupExtended instead of ofxGuiMatrix (it has the same feature with only one active toggle):
ofParameterGroup cameraMatrixParameters;
ofParameter<bool> cam0, cam1, cam2, cam3;
ofxGuiGroupExtended matrixCam;
cameraMatrixParameters.add(cam0.set("cam0",false));
cameraMatrixParameters.add(cam1.set("cam1",false));
cameraMatrixParameters.add(cam2.set("cam2",false));
cameraMatrixParameters.add(cam3.set("cam3",false));
matrixCam.setup(cameraMatrixParameters);
matrixCam.setShowHeader(false);
matrixCam.setAlignHorizontal();
matrixCam.allowMultipleActiveToggles(false);
guiCameraPanel.add(&matrixCam);
Problem with this is that there seems to be no easy way to change the panel width.. I added this to exampleControls, you can see the result there.
Further I can only recommend that you wait until the new version of ofxGui / ofxGuiExtended is part of OF or in the meantime use the OF fork with the new ofxGui in it: https://github.com/frauzufall/openFrameworks/tree/refactor-gui-extended In this branch you can set a fixed item width when using ofxGuiGroup:
ofParameterGroup cameraMatrixParameters;
ofParameter<bool> cam0, cam1, cam2, cam3;
cameraMatrixParameters.setName("cameras");
cameraMatrixParameters.add(cam0.set("cam0",false));
cameraMatrixParameters.add(cam1.set("cam1",false));
cameraMatrixParameters.add(cam2.set("cam2",false));
cameraMatrixParameters.add(cam3.set("cam3",false));
ofxGuiGroup::Config toggle_group_config;
toggle_group_config.layout = ofxBaseGui::Horizontal;
toggle_group_config.exclusiveToggles = true;
ofxBaseGui::Config toggle_item_config;
toggle_item_config.shape.width = 60;
panel5.add(cameraMatrixParameters, toggle_group_config, toggle_item_config);
.. or you can use ofxGuiMatrix:
ofxGuiGroup matrixCam;
ofParameterGroup cameraMatrixParameters;
ofParameter<bool> cam0, cam1, cam2, cam3;
cameraMatrixParameters.setName("cameras");
cameraMatrixParameters.add(cam0.set("cam0",false));
cameraMatrixParameters.add(cam1.set("cam1",false));
cameraMatrixParameters.add(cam2.set("cam2",false));
cameraMatrixParameters.add(cam3.set("cam3",false));
matrixCam.setup(cameraMatrixParameters, 4);
matrixCam.setExclusiveToggles(true);
panel5.add(matrixCam);
..optionally with a fixed container width:
ofxGuiMatrix::Config matrix_config;
matrix_config.columnCount = 4;
matrix_config.shape.width = 400;
matrixCam.setup(cameraMatrixParameters, matrix_config);
matrixCam.setExclusiveToggles(true);
panel5.add(matrixCam);
I also added the last example code to the advancedControlExample in this fork.
in the example it is with
But i need an ofParamaterGroup for an ofAddListener() so i tried it with
an that's what I get:
This would be enhanced with radio-Buttons, what is actually a subfunction of a matrix with only one active toggle