Problem adding pages to a TabbedComponent


#1

I have a TabbedComponet object with 3 tabs.
Tabs hold 16 meters each, with label id on each meter.

Inside TC constructor I add pages as follows:

addTab (T("Meters 1-16"), Colours::gainsboro, createMetersPage(filter,16,0),  true);
addTab (T("Meters 17-32"),Colours::gainsboro, createMetersPage(filter,16,16), true);

where createMetersPage is a method that returns a new page.

Component* createMetersPage(XRPFilter& filter, const int howMany, const int firstIs)
{
  XRPPageComp* page = new XRPPageComp();
  
  for (int i = 0; i < howMany; ++i)
  {
    XRPMeter* meter = new XRPMeter();
    const int xpos = 10+(i*30);
    
    meter->setBounds(xpos, 10, 20, 192);
    meter->setChannel(i+firstIs);
    filter.Peak(i).addChangeListener(meter);

    Label* pLabel = new Label(T("metlabel") + String(i), String(i+1));
    pLabel->setBounds(xpos,210,18,16);
    
    page->addAndMakeVisible(pLabel);
    page->addAndMakeVisible(meter);    
  }
  return page;
}

The results is that the two tabs are identical, the second is equal to the first.
I can’t understand why, I’ve tried to remose static declaration for createMetersPage but without success.

Many thanx in advance for your precious suggestions!


#2

Are you sure it’s not just your label text that’s wrong?


#3

ok :oops: , the text is wrong, but the meters display the wrong level too.
Let’s assume the plug has 2in2out. In the second page i saw the first 2 meters (17,18) showing the same level of meters 1,2, insted of zero…but maybe it is better I take a look in my code.

thanx

PS: Found the problem! :lol:


#4