2020-05-05 12:37 PM
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.
2020-05-06 12:11 AM
Hi @JHarding ,
One way to address this situation could be to declare the functions that update the scroll list & take action as virtual & have as many classes as the number of times you wish to use this custom container. In each of the classes override these functions with the behaviour that you desire.
/Jagdish