Getting data from List Layout Elements
I am not very experienced with CPP or TouchGFX. I have created a Custom Container with a TextArea, a ToggleButton, and a couple of ScrollWheels. I have created a list layout, and used .add() to add two new instances of the Custom Container to my list at run time. The purpose is to create a list of alarms with a title, and some settable parameters for the User to set and save. I have figured out how to load the saved values into the ToggleButton and ScrollWheels from the values saved in the Model in setupScreen.
listLayoutAlarmList.setWidthHeight(0,0); //Compensates for the list height that is set to 200 by the designer
listLayoutAlarmList.setDirection(touchgfx::SOUTH);
for(int i=0;i<2;i++)
{
CustomContainerAlarm *ac = new CustomContainerAlarm();
ac->setListElements(i, (int)!presenter->getAlarmEnable(i), presenter->getAlarmPriority(i), presenter->getLimitF(i), presenter->getAlarmRelay(i));
listLayoutAlarmList.add(*ac);
}
listLayoutAlarmList.invalidate();
But now I need to save the current settings from each alarm (Custom Container) back to the Model during tearDownScreen.
I thought I could get the first Child of the ListLayout, and step through to the last Child by incrementing the pointer. But getFirstChild returns a Drawable *. How do I use this to get the TextArea (so I can tell which alarm I have) from inside the CustomContainer it must be pointing to, then each of the other elements in the CustomContainer so I can for example save whether the ToggleButton is on or off.
Then how do I move to the next list layout element, and how do I tell when I am at the end?
