2023-11-15 02:06 AM
Hello. I apologize in advance for any mistakes, as English is not my native language. I've encountered a problem: I have a custom container named ContainerAddTab, which contains a ScrollableContainer element, named scrollableContainer1. Into this element, I insert ProgramTab tabs named programTab. A problem occurs when adding more than 5 tabs. The spacing between the tabs begins to increase and reaches the width of the screen. This behavior is always the same and does not change. What could be the problem?
ProgramTab::ParamsTab& params = ProgramTab::getStruct();
tab.setWidth(params.tabWidth);
tab.setHeight(params.tabHeight);
if (programTabs.size() - 1 > 0)
{
tab.setCoords(__TAB_START_X + params.tabWidth * (programTabs.size() - 1) + params.spacing * (programTabs.size() - 1), __TAB_START_Y);
}
else
{
tab.setCoords(__TAB_START_X, __TAB_START_Y);
}
tab.setTabClickedCallback(tabClickedCallback);
tab.setActive(true);
screen->loadProgram(tab.getId());
scrollableContainer1.add(tab);
tab.setTabColor();
addProg.setX(__TAB_START_X + params.tabWidth * programTabs.size() + params.spacing * programTabs.size());
A bit about the code. In the ContainerAddTab class, I store an array of ProgramTab tabs, as well as a vector of pointers to these tabs.
I am trying to implement addition, deletion, and achieve correct behavior in their display. I would be grateful for any help.
Regards.
Solved! Go to Solution.
2023-11-15 05:46 AM
It was resolved that for dynamic addition it is necessary to use scrollableContainer1.reset();
2023-11-15 05:46 AM
It was resolved that for dynamic addition it is necessary to use scrollableContainer1.reset();