We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Using Processing 2.x I would like to have back ControlWindow to move all controls in an external frame.
I wrote for Processing 1.x a simplified GUI based on ControlP5 where for a few controllers I frequently use I don't need to calculate positions or remember strange properties: i.e. ctrlAddButton("function", "label")
adds a button finding a place for it, changing font and colors, etc. My code takes care to position each control without overlappings.
Not nice but it is extremely fast to add controls as necessary.
Using ControlWindow controls are created in main setup() and moveTo() the external frame.
Now ControlWindow is no more available and the controls in the main frame partially hide the image I am working with. I saw the workaround in ControlP5frame's example to create an external frame for controls but the solution is... "dirt".
Is there the possibility to add a control with a call from the main setup() and link it to ControlFrame, instead of putting all calls inside ControlFrame's class setup()?
Alex
Answers
Could you explain why is the solution "dirt"?
Ankhelos, For the sake of simplicity I would like to rewrap ControlP5.
To put controls on a separate frame I need to extend PApplet (public class ControlFrame extends PApplet {..) with controls created INSIDE. But I need to add them dynamically when necessary.
I would prefer to define ControlFrame WITHOUT controls creation inside, and add controls dynamically from setup() after ControlFrame has already been created. Alas I couldn't find the syntax to do it (if it is possible in Processing/Java).
At the moment I can create a set of controls from setup() with some easy calls, but controls are on the main frame, not on the separate one:
It's not that hard to instantiate more than 1 PApplet. I've got a template which simply does that: :-bd
http://forum.processing.org/two/discussion/6822/mousepressed-from-another-frame
http://forum.processing.org/two/discussion/7036/multiple-screens
It's an ugly boilerplate indeed. But we can place it in another tab, far away from our eyes! :-\"
Now we can have as many PApplet classes as we want to. They behave as separate sketches: <:-P
Thank you GoToLoop! It is not as clean as ControlWindow but I will give it a try. Alex
Just a note: sketchPath() read from MyApp or MyFrame returns the path of Processing.exe, not the real sketch path...
Oh, it seems like Processing's IDE somehow fails to send sketchPath, or flat out refuses to, when we provide our own override for Processing's default template of main(): :-w
Only fix I've found out so far is exporting such sketch w/ CTRL+E and run it outside Processing's IDE. :-\"
BtW, here's another slightly variation for multi-PApplet instantiation.
Besides instantiating subclasses, do that for the main sketch as well: \m/
http://forum.processing.org/two/discussion/7519/how-to-change-background-color-of-present-mode-and-remove-graphical-stop-option
Thank you GoToLoop. Lot to learn from your posts, as usual. Alex