Skip to main content
ECoud.1
Associate III
April 26, 2021
Question

Hello, I have a problem with touchgfx toggle button. The "clicked function" is called when we make interaction. This function is called only when the button is switched on. How can I make a function that is called when we switch off the button ?

  • April 26, 2021
  • 2 replies
  • 1017 views

..

This topic has been closed for replies.

2 replies

TLe.4
Associate II
April 26, 2021

You can have a boolean or track the state through an enum of whether the button is ON/OFF. This can be done within your screen view .cpp file or presenter file whichever fits your system the best. For example, I just have an enum tracking the state of the button and every time the button is clicked it will change to the other state depending on conditions I set. You are really keeping track of the button yourself and not touchgfx. To change the UI to look responsive I would look at the current state and set the button to the proper color and label to match the state.

ECoud.1
ECoud.1Author
Associate III
April 27, 2021

Thanks for your help, I will try this.