2024-10-22 03:26 AM - edited 2024-10-22 04:48 AM
How to know if a button of the custom container located in (...\TouchGFX\generated\gui_generated\src\containers\TestBottonsBase.cpp) is pressed when we are inside of (...\TouchGFX\gui\src\screen_screen\screenView.cpp).
I don't know how to define a flag inside of TestBottonsBase.cpp and check it inside of screenView.cpp.
Is there any other solution rather than defining a flag?
TestBottonsBase.cpp :
void TestButtonsBase::buttonCallbackHandler(const touchgfx::AbstractButton& src)
{
if (&src == &testButton1)
{
[define a flag here]
}
}
screenView.cpp :
void screenView::handleTickEvent()
{
[check that flag here]
}
Solved! Go to Solution.
2024-10-23 05:39 AM
Hello @Jj.21,
When you create your custom container and place a button inside it, you can easily use the available Interactions to assign your desired functionality. Therefore, you don't need to check whether the clicked button was part of your TestButton.
Also, it is good to point out that the files generated by TouchGFX which are placed at gui_generated should not be modified by the users because they will be regenerated and replaced when TouchGFX regenerates code.
Bottom line, you can set an interaction for your button (like the picture below):
And modify the user container code (MyCustomContainer.cpp and MyCustomContainer.hpp in this case) as you need it.
In case you want to communicate data (like a value) between the container and the screen, then I suggest following Tutorial 5 to learn about the process.
I hope this helps you!
Don't hesitate to ask more questions if you have any!
2024-10-23 05:39 AM
Hello @Jj.21,
When you create your custom container and place a button inside it, you can easily use the available Interactions to assign your desired functionality. Therefore, you don't need to check whether the clicked button was part of your TestButton.
Also, it is good to point out that the files generated by TouchGFX which are placed at gui_generated should not be modified by the users because they will be regenerated and replaced when TouchGFX regenerates code.
Bottom line, you can set an interaction for your button (like the picture below):
And modify the user container code (MyCustomContainer.cpp and MyCustomContainer.hpp in this case) as you need it.
In case you want to communicate data (like a value) between the container and the screen, then I suggest following Tutorial 5 to learn about the process.
I hope this helps you!
Don't hesitate to ask more questions if you have any!
2024-10-27 03:53 AM
Thank you. Your advice was very helpful.