controlP5: Use Tabs within a ControllerGroup or use ControlGroupCanvases?
in
Contributed Library Questions
•
2 years ago
By defaults, tabs apply to the whole window; when you add tabs they appear starting in the top left corner of the screen and each tab is positioned horizontally across the top of the screen. They are always visible unless you programatically hide them. Tabs are designed to work with separate control windows.
ControllerGroups are controls that can be opened and close, and draw in the main drawing window. They have a bar you can click on the make the controls set to the controller group be visible or hidden depending upon whether the controllgroup is open or closed. I think they are designed to be used with controls appearing in the main drawing window.
And, there are also ControlCanvas and ControlGroupCanvases that can apparently be added to either tabs or ControllerGroups, which are different things. I want to make my controlgroup take up half the width it presently does, and, in order to do that, I need to add the new controls I need to include onto some new control space that draws over and hides the controls presently appearing in the controlgroup.
ControllerGroups are controls that can be opened and close, and draw in the main drawing window. They have a bar you can click on the make the controls set to the controller group be visible or hidden depending upon whether the controllgroup is open or closed. I think they are designed to be used with controls appearing in the main drawing window.
And, there are also ControlCanvas and ControlGroupCanvases that can apparently be added to either tabs or ControllerGroups, which are different things. I want to make my controlgroup take up half the width it presently does, and, in order to do that, I need to add the new controls I need to include onto some new control space that draws over and hides the controls presently appearing in the controlgroup.
- /**
- * Sketch for testing controlP5 Buttons.
- *
- * UNBSD 2010 (BSD Licensed, fair use)
- */
- import controlP5.*;
- ControlP5 controlP5;
- ColorPicker cp;
- Toggle scroll; // Toggle is depreciated; alternate?
- Toggle showdescback;// Toggle is depreciated; alternate?
- Toggle showtitleback;// Toggle is depreciated; alternate?
- void setup() {
- size(600,200);
- // add controlP5 to the sketch. mandatory.
- controlP5 = new ControlP5(this);
- // These controls are unassigned to groups and appear all the time
- controlP5.addSlider("Speed",1,20,12,width-176,height-15,100,10);
- controlP5.addButton("READ",0,width-34,height-24,30,19);
- controlP5.addButton("SPEAK",0,width-224,height-24,30,19);
- // create a control group; MAYBE IT SHOULD BE A CONTROLGROUPCANVAS ???
- ControlGroup l = controlP5.addGroup("Settings",0,10);
- l.setBackgroundColor(color(102, 102, 255,200));
- l.setBackgroundHeight(200);
- l.setMoveable(true);
- l.setWidth(600);
- // start with the control group closed.
- l.close();
- // create a toggle with custom label and add it to the ControlGroup l
- scroll = controlP5.addToggle("Scrolling Headlines",true,10,20,10,10);
- scroll.captionLabel().style().marginTop = -12;
- scroll.captionLabel().style().marginLeft = 25;
- scroll.setGroup(l);
- // create a toggle with custom label and add it to the ControlGroup l
- showdescback = controlP5.addToggle("",true,10,44,10,10);
- showdescback.captionLabel().style().marginTop = -24;
- showdescback.captionLabel().style().marginLeft = 0;
- showdescback.setGroup(l);
- // add a basic slider to ControlGroup l
- controlP5.addSlider("alpha_desc",1,255,130,40,44,100,10).setGroup(l);
- // add a basic bang to ControlGroup l
- controlP5.addBang("SetDesc",200,44,10,10).setGroup(l);
- // create a toggle with custom label and add it to the ControlGroup l
- showtitleback = controlP5.addToggle("TitleBack",true,10,68,10,10);
- showtitleback.captionLabel().style().marginTop = -24;
- showtitleback.captionLabel().style().marginLeft = 0;
- showtitleback.setGroup(l);
- // add a basic bang to ControlGroup l
- controlP5.addBang("SetBack",200,68,10,10).setGroup(l);
- // add a basic slider to ControlGroup l
- controlP5.addSlider("alpha_title",1,255,130,40,68,100,10).setGroup(l);
- // create and add a color picker slider to ControlGroup(1);
- cp = controlP5.addColorPicker("picker",10,106,255,20);
- cp.setGroup(l);
- // TO DO/FIGURE OUT
- // Add Multiple ControlGroupCanvases to ControlGroup and Assign Controls
- // to specific canvases.
- }
- void draw() {
- background(0);
- }
- void controlEvent(ControlEvent theEvent) {
- if (theEvent.controller().name()=="READ") {};
- if (theEvent.controller().name()=="SPEAK") {}
- if(theEvent.controller().name().equals("SetBack")) { }
- if(theEvent.controller().name().equals("SetDesc")) { }
- }
- void Speed(float DELAY) {
- //feedRate = int(DELAY*1000);
- //println("a slider event. setting background to "+DELAY);
- }
1