2019-05-21 10:53 PM
Hi, I have a common custom container that is included in all my views.
I need to access a method from the model, usually, in a view, I do this from the presenter, how can I do this in the custom container in a general way without passing the view to the custom container?
Thanks,
Eyal
2019-05-24 05:11 AM
Hi Eyal!
Are you reluctant to pass the view because you don't know the type? You could have those views that need this custom container to inherit from a base view with the functionality to interact with the model. Or, you could use generic callbacks depending on what you're looking to do.
/Martin
2019-05-24 05:20 AM
Hi Martin,
Thanks for getting back to me.
The case is this, I have a common custom container that is included (from with in the designer) in all my views (more then 40) and I want to access the model from within the custom container.
If I need to pass the view to the customer container then I need to go to each view setup and call a customer container method that take the view, I want to avoid this if possible.
Thanks!
Eyal
2019-05-24 05:27 AM
If every view needs this custom container, create a Base View that declares this container and adds it to the root view container and then have every view inherit from it.
/Martin
2019-05-24 06:10 AM
I'm not sure I follow your idea, I have a designer project with existing 40 screens\view, now, on top of that, the need is raised to add a custom container to all those views.
How can I make a base view in that scenario and make all the existing screen inherit from it?
2019-05-27 04:24 AM
Hi Eyal,
The idea is to only declare the Custom Container member in a baseview that is shared by all - This feature is not supported by the designer, so you will have to edit all your screens and new screens that you create. I will see if i can take the time to create an example for you.
/Martin
2019-08-28 03:02 AM
Hi Martin,
I'm having the same issues as Eyal did and it would be really helpful if you could create an example for an small application.
Basically a application in which a designer generated view inherits from a custom base view. I'm aware that for this a modification by hand will be necessary.
Thanks
Michael
2019-09-25 07:01 PM
Hello, I am also trying to acheive the same thing and would really appreciate an example of how to modify the generated files to achieve this!
2020-02-25 03:20 AM
Hi,
Same, i would really appreciate an example of how to implement this.
Thanks,
Dani
2020-06-11 03:13 PM
I've added an answer to a similar (kind of...) problem in this post https://community.st.com/s/question/0D50X0000AFpwBx/can-you-call-a-method-on-view-from-a-custom-container.
Hope it helps