2024-10-17
08:28 AM
- last edited on
2024-10-17
11:02 PM
by
Lina_DABASINSKA
Hi there Touchgfx team!
I have a view with a custom container list as in the ListLayout example.
class test_selectionView : public test_selectionViewBase
{
public:
test_selectionView();
virtual ~test_selectionView() {}
virtual void setupScreen();
virtual void tearDownScreen();
/**
* Handler of list element clicks.
*/
void listElementClicked(CustomListElement &element);
protected:
static const int number_of_select_test_kit_list_elements = 30;
CustomListElement select_test_kit_list_elements[number_of_select_test_kit_list_elements];
// Callback that is assigned to each list element
Callback<test_selectionView, CustomListElement &> listElementClickedCallback;
};
I would like to have the number of elements in the model, and access it with a get method. Right now, you can see I'm harcoding the "30" value in the view.
I already created number_of_select_test_kit_list_elements in the model and created the get method, because that number will be used across several screens.
How can I create the CustomListElement using the get method from the model?
Thanks a lot in advance
Solved! Go to Solution.
2024-10-18 02:41 AM
Hi @JPabl.1,
You can refer to this tutorial to create a model : https://support.touchgfx.com/academy/tutorials/tutorial-03.
To have the number of element you have to create your own "count" function the model.
BR,
2024-10-17 09:10 AM - edited 2024-10-17 03:07 PM
You posted this in the 'Feedback' forum - that's not the right place for it!
Moved to the TouchGFX forum
2024-10-18 02:41 AM
Hi @JPabl.1,
You can refer to this tutorial to create a model : https://support.touchgfx.com/academy/tutorials/tutorial-03.
To have the number of element you have to create your own "count" function the model.
BR,