We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › [controlP5] Add a scroll list in a separate window
Page Index Toggle Pages: 1
[controlP5] Add a scroll list in a separate window (Read 850 times)
[controlP5] Add a scroll list in a separate window
May 9th, 2008, 10:30am
 
Hi,

First, all my gratitude to Sojamo for the brilliant ControlP5 library!

I want to add a scroll list to a second window, but I couldn't find how this should work. The method setWindow() works with the elements of the type Controller, but the scrollList is not a Controller (or is it?).

Typically, this doesn't work:
(Semantic Error: No accessible method with signature "setWindow(controlP5.ControlWindow)" was found in type "controlP5.ScrollList".)

Code:

ControlP5 controlP5;

ControlWindow controlWindow;

controlP5 = new ControlP5(this);
controlWindow = controlP5.addControlWindow("Sound Library",100,100,200,400);

ScrollList l = controlP5.addScrollList("myList",100,100,120,280);

l.setWindow(controlWindow);


Thanks,
Jean-Baptiste

PS: the constructor "Controller" clashes with a constructor of the same name in the P5 library Promidi.
Re: [controlP5] Add a scroll list in a separate wi
Reply #1 - May 24th, 2008, 2:39pm
 
I actually ran into the same problem that many subclasses of Controller dont really seem to have setWindow included. The moveTo() class also does not seem to support all constructors from the documentation. Anyways I solved the problem with the scrolllist by simply putting a tab to my controlwindow and afterwards setting the new tab for the scrollList:
Code:

import controlP5.*;

ControlP5 controlP5;
ControlWindow controlWindow;


void setup() {
size(400,400);
frameRate(30);
controlP5 = new ControlP5(this);
controlP5.setAutoDraw(false);
ControlGroup grp1 = controlP5.addGroup("myGroup",50,200);
controlWindow = controlP5.addControlWindow("controlP5window",100,100,600,400);
controlWindow.setBackground(color(40));
controlP5.addTab(controlWindow, "new");

ScrollList l = controlP5.addScrollList("myList",100,100,120,280);
l.setTab("new");
l.setLabel("something else");

for(int i=0;i<40;i++) {
controlP5.Button b = l.addItem("a"+i,i);
b.setId(100 + i);
}
}

void myList(int theValue) {
println("ddd");
}


nice lib. even though I'd like to know if I do something wrong or if things are not completed yet.
Re: [controlP5] Add a scroll list in a separate wi
Reply #2 - May 25th, 2008, 5:50pm
 
see this post for updates.
Page Index Toggle Pages: 1