2023-04-18 10:26 PM - edited 2023-11-20 07:46 AM
I've created list in my view window:
and by add new date I create elements in list. My custom container looks like that:
When I click plus button it calls this function:
How u see there is ProfileCount++; variable and I need to pass that value in to my view window. I ve tried to create object and by function pass index to my view but simulator always crashes when i do that. So maybe someone knows how to pass information from list elements?
2023-04-19 05:43 AM
Hello @heyo,
When trying to share a variable between different screens, I'll suggest to use the Model-View-Presenter pattern. Please take a look at this article to learn on how to propagate data between those layers.
Here, I think that you could send the ProfileCount variable to the Model from your Container, and then read this value from your view.
/Yoann
2023-04-19 05:56 AM
Hello @Yoann KLEIN
But if I want to pass that value to model I need to pass it to my view screen, and I don't know how to pass it from list, cause I've creating list by clicking plus button. I've tried to create an object of class and pass it by function but simulator crashes, also I've tried to point to my view window and also crashes.
2023-04-19 06:36 AM
If you want to pass a variable from a custom container its parent view, you can see how it is done in the Custom Trigger Action Example available in TouchGFXDesigner.
There you'll see how to use triggers with parameters in Custom Containers and how to retrieve these parameters in the main view.
/Yoann
2023-04-19
08:52 AM
- last edited on
2023-12-06
04:57 AM
by
Laurids_PETERSE
@yoann KLEIN But how to do if I do not put container in view screen? Just putting elements from container in list.
2023-04-20 02:08 AM
Then I think you have to use callbacks, please take a look at this article and this one.
/Yoann
2023-04-20 02:28 AM
It can be used if in list layout is another list layout and in that list I need to pass index? I need to pass index from last list to view window
2023-04-20 03:00 AM - edited 2023-11-20 07:46 AM
@yoann KLEIN
But what to do if it's not added to view? Can you share a mini example to make me understand?