Handling a large number of controls efficiently

Hi all!

I'm currently building a plugin which comprises a large number of GUI components, over 64 per screen. How could I efficiently handle such a number of components, both programmatically and computationally? The Introjucer isn't going to cut it, but I'm afraid adding components programmatically isn't very practical either...

Specifically, what I'm trying to do is a large number of adjacent vertical sliders, à la graphical equalizer.

Thanks for you help!

Hi, you'll have no problem doing that programatically - you can probably just use a loop to iterate and create multiple instances of Slider and adjust the x co-ords appropriately?

 

Yes, that's what I first thought indeed. Can I simply rely on automatic positioning or should I do the hard work myself? Also, Is there a way to create a custom component to be reused in my views? Sorry for the newbie questions but the tutorials are still pretty much blank for these topics :(

Something along the lines of:

OwnedArray<MySlider> controls;

for( int i = 0; i < 10; i++ ) {
  MySlider *p_control = new MySlider( ... );

  p_control->setBounds( i * 50, 0, 20, 0 );
  ...

  controls.add( p_control );
}

Just derive MySlider from Slider and add your functionality...

Well make them a class and then you make new every time you need one :) You certainly can make custom components in the introjucer or "by hand" and then reuse them. That's how we all do them. Just make the general enough.

I see, thanks!

BTW, I was thinking about making a component grouping the bunch of sliders, rather than making a custom slider. Will investigate!