Skip to main content
mSH.1
Associate III
June 2, 2022
Question

Another function is called when a button is clicked in TouchGFX.

  • June 2, 2022
  • 4 replies
  • 2476 views

  1. The operation of the touch button was confirmed through the example of the existing TouchGFX.

0693W00000Nr65tQAB.png

I reviewed the Button example in TouchGFX Designer.

0693W00000Nr65ZQAR.png

As in the captured image above, I figured out the structure of the function that is called when the touch button is pressed using a break in MainViewBasee.cpp

0693W00000Nr66SQAR.png

If you break the break in "void MainViewBase::buttonCallbackHandler(const touchgfx::AbstractButton& src)"

and look at each step, you can see that it is normally called with a normally defined function.

0693W00000Nr68JQAR.png

However, the problem is that other functions are called in the project you created yourself.

It should be "SC5_1_decreaseValue" or "SC5_1_increaseValue",

but "void Screen5_1View::tearDownScreen()" is called.

0693W00000Nr68dQAB.pngIf you apply the brake, press "botton_up" and confirm with a single step,

0693W00000Nr69MQAR.png 

After entering the condition in button_up in the if statement, it is executed as the button_down part in the next step.

and

in the next step

"void Screen5_1View::tearDownScreen()"

will run as

There doesn't seem to be much difference compared to the example source that works normally, but what the hell is the problem?

This topic has been closed for replies.

4 replies

Yoann KLEIN
ST Employee
June 2, 2022

Hello @mSH.1​ ,

To be honest, I don't understand your question.

Can you please provide more details on how should your project work, what is happening and what's wrong ?

Could you also edit or reformulate some parts of your post, because it's quite confusing and hard to understand.

Thanks,

/Yoann

Yoann KLEINST Software Developer | TouchGFX
mSH.1
mSH.1Author
Associate III
June 2, 2022

Sorry for the inaccurate explanation

Let's tidy up

If you look at the captured figure at the bottom, it is a callback function for when the button is pressed, and there is a virtual function to be executed in that function.

-> increaseValue();

-> decreaseValue();

However, the function that is actually executed is teardownscreen().

even if you brake

Teardownscreen() is called even when running in single step.

The difference from the basic example is that the teardownscreen() function seems to have only a difference in definition.

There is no teardownscreen() function in the basic example.

mSH.1
mSH.1Author
Associate III
June 3, 2022

I found a warin by myself

The problem was that I did not put anything in the virtual function in view.cpp in the gui folder.