Generate several instance from a component class


#1

Dear

I am trying to make plug-in which can be set to add or remove rack in plug-in.

In view of common plug-in that has only one input, it looks weired. But my target is MAX or Reaper, so it can be.

All modules have same function. Here is my idea


      Label          Slider      Slider          Slider          Slider

A[Track Number] [Gain] [Directivity] [Function1] [Function2]
B[Track Number] [Gain] [Directivity] [Function1] [Function2]
C[Track Number] [Gain] [Directivity] [Function1] [Function2]
D[Track Number] [Gain] [Directivity] [Function1] [Function2]

J[Track Number] [Gain] [Directivity] [Function1] [Function2]
K[Track Number] [Gain] [Directivity] [Function1] [Function2]

class A consistance: { [Track Number] [Gain] [Directivity] [Function1] [Function2] }

I just designed a class(named A) inherited from component and registered a few necessary listener for other sub components such as slider, text editors. And I generate through “new A” and put those in OwnedArray.

Then I iterate each element, then addAndMakeVisible action. It only shows just one A instance. Trying to a few tests more, but is there anyone have similar experience or knowledge for boosting my speed up?

Best Regards,
Alan


#2

If the intention is to display them all side-by-side, are you updating their positions as you iterate?

For each iteration you should generate the new component and then call setBounds on the component to set its position, relative to the parent.


#3

Dear MarkC_SSL

Yeah, you pointed out my problem. I checked out my code again, then I found something mistake on setting region for each component. I solved it. Setting a few things for display cannot be familiar for beginner.

I concerned about the function of OwnedArray container, but that’s not problem. I was foolish I thought like that.

Thanks Mark!

Regards,
Alan