cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX - switch between containers

ASteg.1
Associate II

Hi everyone,

I am a beginner in TouchGFX.

Right now I have created several containers with different buttons.

My goal is as follows:

When klicking a button of one container I want to change to another container.

So far I have found only the possibility to change between screens but not between containers.

Thanks in advance!

Antonia

6 REPLIES 6
Yoann KLEIN
ST Employee

Hello @ASteg.1​ ,

Did you consider using a SwipeContainer ?

That could be a solution for you.

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX
ASteg.1
Associate II

Yes I already thought about SwipeContainer, but first of all I can only change the container by swiping but I want to define a click button.

And second, I don't have one clear order how I want to go through my containers. Sometimes it depends on the clicked button to which container I want to go next.

Yoann KLEIN
ST Employee

If you created several containers, one solution could be to, after the click on your button, make the current container disappear but calling the function setVisible(false) and making the container you want appear on the screen but calling setVisible(true).

You will have to use interactions in TouchGFXDesigner to achieve that.

Hope that helps,

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX
ASteg.1
Associate II

Thanks for the reply!

I have tried it, but now I have the problem that my button is inside of the FirstContainer. And I am only able to setVisible(false) the current FIrstContainer my button is in. But I don't find a way to reache out to the other SecondContainer and set it visible.

I have alredy tried to "get" the instance of the second container via code inside of my firstContainer.hpp but I don't find a function to modify my secondContainer.hpp inside of the first one.

I am thankful for any suggestions!

Yoann KLEIN
ST Employee

Does customContainer2.setVisible(true) not work ?

If you create a widget for each of your containers, they should all have a different name, and then you should be able to access them.

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX
ASteg.1
Associate II

No customContainer2.setVisible(true) does not work, beacuase I am inside of my customContainer1 when defining my Button1press.

And customContainer1 does not now customContainer2. If I am trying it I get the error: "customContainer2" was not declared in this scope.

This is my setup and I want to define what happens after my buttonclick inside CustomContainer1:

0693W00000WKLGNQA5.png