cancel
Showing results for 
Search instead for 
Did you mean: 

Callbacks between container and view

Priyank
Associate III

Hi, I went through some other discussions discussing a similar problem, but they did not seem to help. 

I have screen one which displays (dynamically) a container. The container has a button on it, which when clicked, changes screens to screen 2. At the same time the container needs to send data to screen 2 (an int). The button is a flex button which I set up from the GUI call a virtual function. 

I would prefer a way where the container is not permanently tied to screen 2, as this container appears on multiple screens and does something similar.

13 REPLIES 13
GaetanGodart
ST Employee

Hello @Priyank ,

 

Did you solve this issue?

I saw that you created a new topic (the new topic ).

If you did, I invite you to select the comment that was the most helpful (if any) as "best answer". :smiling_face_with_smiling_eyes:

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

While studying this how to pass information from Widget/View/Presenter/Model.
I've been struggling with the callbacks.

One of the thing I found was the use of Canvas to allocate memory beforehand for dynamic widget creations.
Check Demo2/HomeAutomationView()/CanvasWidgetRenderer as an example.
(This one is going to he complicated, check the MVPHeader for possible "global" memory.)

Did you figure out a way to have interactions between a customWidget/View back and forth without having to make many callbacks?

Hi, I did find the solution, it still uses callbacks, however they are generated callbacks. I used this tutorial right here, where you would utilize actions, triggers, and interactions.

 https://support.touchgfx.com/4.18/docs/tutorials/tutorial-05

Thanks for the reference but I found a solution yesterday.

For posterity:
The gist of what I understood it is:

  • Use "GenericCallback" for outgoing calls from the Widgets context.
  • Use "Callback<CustomWidget>" for incomming calls.


Context switching ties in with the MVP.
I used "Demo2" and "Understanding Application Structure" to finally get it.