We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi all.
I need to display in a textarea the number of objects in canvas. These objects change often in time.
I tried with Behaviour, but Textarea class doesn't inherit setBehavior() method like e.g. the Slider class (why!?).
I tried with something like
void updateObjectNumber(){ Textarea textarea = ((Textarea)controlP5.getController("objectNumber")); textarea.setText(objects.size()); }
but it raise a casting error.
How can i do?
Thanks a lot!
Answers
code in previous post fixed:
Hi, I posted a working example below. To access the Textarea, use
gui.get(Textarea.class, "boidsNumber")
this will make ControlP5 return a controller of a particular class (if matching the original). Instead of using a Textarea you could also use a Textlabel.Yes! Thanks so much.
Resolved.
@calcolo
If your question has been answered then please mark the discussion as 'Answered' when prompted to do so. This makes it clearer in the listings. :)