cancel
Showing results for 
Search instead for 
Did you mean: 

How to manage a custom container using a widget inside that container?

NGune.1
Associate III

Hi,

Just another point I am stuck on and coudn't find a solution.

I created a specific keypad as a custom container, to use it under several views. Initially it is hidden. I can show it by using keypad.setVisible(1) in those xxView.cpp's whenever necessary. BUT, I coud not find a way to hide it by pressing a button which is contained in that custom container. 

(I don't want to construct this keypad in a Modal Window, because in that case I will need to create (and program) the exact same window with many buttons under every view.)

Any suggestion?

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

I have tried what you have done.

The issue is that you do not invalidate after.

So TouchGFX knows that it needs to invalidate the button because it has been clicked so there are some animation for it, but it doesn't know it has to invalidate the rest of the custom container.

Simply add invalidate(); in your ESC_Pressed() function.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

View solution in original post

5 REPLIES 5
GaetanGodart
ST Employee

Hello @NGune.1 

 

You can call setVisible(False) from within a custom container and it will set that whole custom container invisible.

Please find attached an example of that.

Please tell me if that solves your question or if I misunderstood the issue.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)
NGune.1
Associate III

Hi @GaetanGodart ,

Thank you for your reply and example code. 

I have a container, called keypad and an "ESC" Button (a flex button) in this container. In the designer I defined an interaction; which calls the virtual function "ESC_Pressed()".

After looking at the example code you sent, In my code I tried:

void keypad::ESC_Pressed()
{
    setVisible(false);
}

This is hiding the "ESC Button" only. I need to hide the entire container. So, unfortunately this didn't solve:(

I have tried what you have done.

The issue is that you do not invalidate after.

So TouchGFX knows that it needs to invalidate the button because it has been clicked so there are some animation for it, but it doesn't know it has to invalidate the rest of the custom container.

Simply add invalidate(); in your ESC_Pressed() function.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

Yes, you are right:) I added invalidate(), after setVisible(false) in my function and now it works, it hides entire container as required.

Many thanks.

My pleasure, I am glad it fixed your issue!

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)