Loading...
Logo
Processing Forum
Hey all

I really like the controlP5 library (I use the latest dev snapshot release). However I didn't figured out how I can mix tabbed elements and "static" elements.

To illustrate my needs, I want some drop down lists, which should be ALWAYS visible. And there is a tabbed area, where different elements are shown.

can someone guide me into the right direction?

cheers and thanks
michu

Replies(4)

Hi, you can move your dropdownlist (and any other controller) to the 'global' tab. here, controllers will always be visible and active.

Copy code
  1. Slider s = controlP5.addSlider("sliderValue",0,255,128,100,200,10,100);
  2. s.moveTo("global");

Hi,

This is a related question.  I would like to add a DropDownList to my second tab.   Here are the relevant chunks of codes (basically copy-paste from the DropDownList and Tab library examples): 


Copy code
  1.   // create a second DropdownList
  2.   cp5.addDropdownList("myList-d2")
  3.           .setPosition(300, 100)
  4.           .setSize(200,200) ;

  5. // other code skipped

  6. // arrange controller in separate tabs
  7. cp5.getController("myList-d1").moveTo("Second Tab");


However, I get a NullPointerException with the following details: 
Exception in thread "Animation Thread" java.lang.NullPointerException
at ta01.setup(ta01.java:138)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)



What is interesting is, I cm able to move a Slider to the second tab just fine:

Copy code
  1. cp5.getController("slider").moveTo("Second Tab");

Would appreciate any input!

-Khalid

Wow, thanks andres for your quick reply and library, a very nice piece of code!
Argh, I found another issue I cannot figure out myself. I created a litte component myself (a color picker which sends the selected color as 24bit value) ( https://github.com/neophob/PixelController/blob/master/src/main/java/com/neophob/sematrix/output/gui/elements/SimpleColorPicker.java

and added it to my main window:

SimpleColorPicker scp = new SimpleColorPicker(cp5, (ControllerGroup)cp5.controlWindow.getTabs().get(1), GuiElement.COLOR_PICKER.toString(), 0, 380, 160, 14);
cp5.register(null, "SimpleColorPicker", scp);
scp.addListener(listener);

unfortunally my eventlistener gets not notified when something happend. the controlEvent gets called in my component, but no event is fired? has this something todo with this fancy registerProperty method?