Customizable Multi-sketch processing program?

#1

Hi Nice to see you here, it would be great that if you can spare some of your time to help me go through this. I have trouble implementing multiple window application on Processing.

Basic Background: I am developing a software for brain-computer interface to get my graduation thesis done, I want to configure it like this.Fig1The purple area is the control panel. The gray area is the layout for the sub-window. If the users want to have a new sub-window, they click the Plot , Fig2 show up , and select the time series Plot( three ways for visualizing the brain signal as you can see), the control panel will generate a new subwindow to show the brain signal in the time domain. For the exact design for subwindow, it has plot and configuration droplist. Like this Fig 3 It has both the Plot component and the configuration component.

Based on information above
So I need a multiwindow display:

  1. The close of them did not affect the main control Bar(main window).
  2. I can customize the controllers(i.e drop-down list, button). to make it compatible with my UI style.
  3. I can use Grafica or other packages to help me with the plot stuff. And I can access them through t

Then I search online:

G4P can help me with1 definitely. For 3 there is a solution but not seem convenient if I have to manage multiple sub-windows.

So I want to make a new class extended from G4P so that I can manage each sub-window as a new object. pseudocode should be like

class MyClass extend Gwindow(){
Control P5
MyClass(pos_x,pos_y,w_width,w_height)
{
//initiate a series of relevant variable
}
viod setup(){}
void draw(){
//some globale variable about the plot.
}
void action_on_close(){
//delete variable about the plot. 
}
}
Then in the main pde file it will be 
void setup()
{
//some button;some droplists
}
ControlEvent(){
//define the behavior of the droplist
// if select the option timeseries plot
//create a new window by
MyClass timeseries = new MyClass(0,0,20,20); 
}

In summary, I am looking for a way to make the view of the subwindow customizable while keep the good feature of the G4P( close the main window without closing the main thread) and My solution is to consider each type of subwindow(timeseries, FFT) as types of class so that I can put the controlP5 and Grafica component into these classes which will ease my development. But I did not find a way to extend the Gwindow object of G4P like pseudocode here.

it would be very nice of you if you can provide help or just leave some comments. Plus: I am also open to other ways to implement it(or another language).
Appreciate your time!

1 Like

#2

Can you post your code so far?

0 Likes

#3

One possibly way might be to draw the single program outputs on separate PGraphics of the size you wish. Then you show the PGraphics canvas in the position you want.

Thus the output is cut off and can’t overlap the separate windows

0 Likes

#4

But controlP5 also allows to have separate windows I guess (or g4p)

0 Likes

#5

Is your goal that ControlP5 and Grafica be sandboxed in each GWindow – e.g. so that none of the ControlP5 elements in one window can affect / communicate with another GWindow or the main sketch?

If not, have you considered a composition approach as an alternative to inheritence? Create a class that contains a GWindow and your Control elements, then pass the GWindow to the elements as their target PApplet. Use the elements as normal, and they render to the target (untested!)

Normally you could render elements to PGraphics buffers and the draw those onto the windows you want, but I believe that ControlP5 does not render to PGraphics: “drawing into a PGraphics object is not possible since an instance of PApplet is passed to each controller for being drawn.” ** Of course, GWindow inherits from PApplet…

@quark is the expert on multiwindow g4p applications. In general I’m not sure about the strategy of mixing both GUI libraries though – it seems like introducing a lot of complexity to be working with two GUI libraries at the same time. If you really want ControlP5 elements in multiple windows then I think the demo is to use an awt frame rather than a G4P GWindow-- would that meet your requirements?

Also possibly relevant to you if you go the G4P+CP5 route:

0 Likes

#6

Are you the guy I have been exchanging emails with over the last few days?

0 Likes