ayari
YaBB Newbies
Offline
Posts: 21
Re: controlP5
Reply #192 - Feb 21st , 2010, 9:35pm
Hi Processing Community, I'm new and have been learning thanks to these forums! I am attempting to use the ControlP5 library to create a dropdown menu. I have successfully done so, however, the drop-down box is dropping OVER the menu tab. I would like it behind. I played around with a Z coordinate, but didn't have much luck. I started this project using the ControlP5ControlFont Example. Would it be possible for anyone familiar with this library to suggest a way to resolve this? Thanks so much for your time!! -- Ayari import controlP5.*; import processing.opengl.*; ControlP5 controlP5; ControlFont font; controlP5.Button buttonOne; int buttonValue = 1; boolean isOpen; int myColorBackground = color(0,0,0); void setup() { size(640,480, OPENGL); smooth(); controlP5 = new ControlP5(this); // (1) //Button A //(name, value, x, y, lengh, width) controlP5.addButton("ButtonA",10, 100,0,80,20).setId(1); buttonOne = controlP5.addButton("Button A Value",10,100,300,80,20); // Set the Color of buttonOne buttonOne.setColorActive(color(255)); buttonOne.setColorBackground(color(132)); //buttonOne.position().z = -50; buttonOne.setId(2); buttonOne.setWidth(200); buttonOne.setHeight(200); } void draw(){ background(0); //Animation Button A buttonOne.position().y += ((isOpen==true ? 20:- 200) - buttonOne.position().y) * 0.2; println("Position Z is: " + buttonOne.position().z); } public void controlEvent(ControlEvent theEvent) { println(theEvent.controller().id()); } public void ButtonA(float theValue) { println("a button event. "+theValue); isOpen = !isOpen; controlP5.controller("ButtonA").setCaptionLabel((isOpen==true) ? "Open":"Close"); }