cancel
Showing results for 
Search instead for 
Did you mean: 

How to do it?

AD�?b
Senior

I have the OFF / ON button. I want one function in the system to be called when the button is pressed and another function is pressed. The button is set to TRIGGER / Toggle. How to do it?

8 REPLIES 8
scottSD
Senior III

By "Off/On" I assume you mean Toggle Button?

I assume you know you about the "Interaction" section in the TouchGFX Designer?

What do you mean you "want one function in the system to be called when the button is pressed and another function is pressed." --how is another function "pressed"?

Romain DIELEMAN
ST Employee

Hi, as @scottSD wrote you should get familiar with the interaction section in Designer. Have a look at Tutorial 2 section 4 to see how to set-up a button and a function when the button is clicked. A Toggle button and a simple button like the one in the tutorial are quite similar. You can then code as you want the function handling the button click event to have a specific function called depending on the state of the button ON/OFF.

/Romain

1. yes

2. yes

3. when the button is OFF, the system works in one mode, as it is ON, the system works in another mode.

Hi!

I'll see. Thank you!

@Andrzej Dębski​  Reading your #3, it appears you want a mode variable to change the behavior of your code based on the state of a toggle button. Use the interaction section Romain gave you a link to. Then, in the virtual function, created a mode variable to act on in your code.

Also, I believe you can simply check the state of a toggle Button to get the state.

I managed this problem. I am sending the project Another problem has arisen. How do I enable messageQ5 receiving support messageQ4 receiving support stops working. If I turn off messageQ4 receiving support, the receiving support does not work either. But if I change the button in TouchGFXDesigner to TRIGGER / Toggle with the messageQ4 disabled, the button works. However, I want it to work with the TouchGFXDesigner setting on TRIGGER / Click. What am I doing wrong.

Hi!

I dealt with the problem. Next time I will ask for help.

Hi, please do ask for help when you have an issue. A community member or us might have the answer, or at least will try have a look and try to help.