We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I tried using the solution given to a similar question years ago. However, when i tried using it a "The type new ControllerView(sketch) must implement the inherent abstract method at Line 20. I tried searching the net but unable to find one that is related to processing... What I want to achieve is add an image and headers inside my Controlp5 tabs.
Here is the code from sojamo : https://forum.processing.org/two/discussion/1380/controlp5-tabs
import controlP5.*;
// using processing 2.0, ControlP5 2.0.4
ControlP5 cp5;
PFont f1;
void setup() {
size(400, 400);
f1 = createFont("Helvetica" , 20);
cp5 = new ControlP5(this);
cp5.addTab("extra");
Container c = new Container(cp5, "hello");
c.setPosition(100, 100).moveTo("extra");
// give controller hello a custom view - just draw
// a white rectangle and a bit of text for a start.
c.setView( new ControllerView<Container>() {
public void display(PApplet p, Container o) {
p.fill(255);
p.rect(0, 0, random(100) + 100, 40);
p.textFont(f1);
p.text("Hello World" , 0 , 60);
}
}
);
}
void draw() {
background( 40 );
}
// an empty container controller
class Container extends Controller<Container> {
Container(ControlP5 c, String theName) {
super( c, theName, 0, 0, 0, 0 );
c.register( null, theName, this );
}
}
Cheers!
Answers
That solution is from 2013! And it seems like ControllerView::display()'s signature has changed. b-(
Apparently, its 1st parameter, instead of PApplet, it is now PGraphics. @-)
Here's my attempt to upgrade it: :\">
Thank you so much!!!