Skip to main content
NGune.1
Associate III
November 30, 2024
Solved

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

  • November 30, 2024
  • 2 replies
  • 1272 views

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.

Best answer by GaetanGodart

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,

2 replies

GaetanGodart
Technical Moderator
December 2, 2024

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,

NGune.1
NGune.1Author
Associate III
December 2, 2024

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:(

GaetanGodart
GaetanGodartBest answer
Technical Moderator
December 2, 2024

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,

NGune.1
NGune.1Author
Associate III
December 2, 2024

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.