Reusable Container with a Scroll List
I have used TouchGFX Designer to create a custom container that has a scroll list within it. This custom container will be a settings menu that I want to be able to use in multiple locations throughout the firmware.
Currently I have this working in one location, and my custom container has a function that is called from the base class to update the scroll list. This works beautifully.
ScrollListUpdateItem(SettingsMenuItem& item, int16_t itemIndex)
{
switch (itemIndex)
{
case 0:
item.setItemDetails(Bitmap(BITMAP_ICONCALSETTINGSSTANDARDSET_ID), T_CALSETTINGSSTANDARDSET, false);
break;
case 1:
item.setItemDetails(Bitmap(BITMAP_ICONCALSETTINGSREMINDER_ID), T_CALSETTINGSREMINDER, false);
break;
case 2:
item.setItemDetails(Bitmap(BITMAP_ICONCALSETTINGSDEFAULTCAL_ID), T_CALSETTINGSDEFAULTCAL, false);
break;
case 3:
item.setItemDetails(Bitmap(BITMAP_ICONCALSETTINGSPOSTVERIFY_ID), T_CALSETTINGSPOSTVERIFY, true);
break;
}
}Now of course, with the current setup if I place this container in another location within the firmware, then it will have the same number of items and the same item details as laid out in the update function posted above. I want the second instance to have a different list of items and different actions associated with each item, without having to recreate all of the common elements within the custom container. I want the view in which the custom container resides in to be in control of updating the scroll list.
- What is the best solution?
- Should the custom container have a function that allows a callback to be set?
- If so how do I setup that callback?
