Skip to main content
heyo
Associate III
February 22, 2023
Question

Can I get callback in my view from custom container which is in another container?

  • February 22, 2023
  • 7 replies
  • 2089 views

Hello,

Is it possible to get callback on my view from custom container which is in another container? And how to do that?

I've tried to do like this. Create a callback for button:

0693W00000aHNeuQAG.pngHere goes when callback gets call. And I create an object of other class to call function:

0693W00000aHNpAQAW.pngAnd goes to this function:

0693W00000aHNptQAG.pngThe problem with this method is that does not perform commands like "setXY" and etc. but only touchgfx_printf works. What I do wrong?

This topic has been closed for replies.

7 replies

MM..1
Super User
March 2, 2023

show code where you add create object Addnewzonebutton

heyo
heyoAuthor
Associate III
March 3, 2023

Addnewzonebutton is in InputOutputConfigurationViewBase it is automatically created by touchgfx

Graduate II
March 3, 2023

Maybe objects needs to invalidate() ?

heyo
heyoAuthor
Associate III
March 3, 2023

No, there is handleTickEvent function and there calls invalidate every tick.

heyo
heyoAuthor
Associate III
March 20, 2023

Hello again,

I'm stuck with it. Maybe someone can help?

heyo
heyoAuthor
Associate III
March 20, 2023

I've tried two methods. Pass index by pointer and by class.

For better understanding what I want to do I try to explain. First of all in my view window is container and in that container I create a list using another container. On the left is my lists.

0693W00000aJIksQAG.pngThis is what I put in list and in this container I put another list:

0693W00000aJIlbQAG.png0693W00000aJIllQAG.pngSo here is "SelectController" button and for that I create callback and by click I get index of that button:

0693W00000aJImAQAW.pngSo I pass that index by pointer in HeatersAndCoolersConfiguration class

0693W00000aJImKQAW.pngAnd this is my function in my view window:

0693W00000aJImUQAW.pngProblem is that simulator crashes when I click SelectController button.0693W00000aJIn3QAG.pngAnother method that I tried to do pass index by function to call function in another class and it passes index but function like setY(), setVisible() does not work