2021-04-06 06:46 AM
Hello,
I have multiple flexbutton and I'd like to change the border size of the button which is pressed only.
In GFX interraction panel I could of course excecute C++ code like flexButtonName.setBorderSize(5); but I'd like to have it in a generic function, with a flexbutton pointer, like this :
void Screen1ViewBase::flexButtonCallbackHandler(const touchgfx::AbstractButtonContainer& src)
{
if (&src == &flexButtonName)
{
//InteractionName
Screen1View::changeBorderSize(&src); //
}
}
// Screen1View.cpp
changeBorderSize(const touchgfx::TextButtonStyle<touchgfx::BoxClickButton>& src)
{
src.setBorderSize(5); // I got build error: "incomplete type 'Screen1View' used in nested name specifier"
}
But I got an error "incomplete type 'Screen1View' used in nested name specifier", it seems that I failed my cast somewhere.
Thanks
Solved! Go to Solution.
2021-04-07 02:21 AM
I solved my problem. 3 steps in touchGFX:
In Screen1: create an action changeBorderSize with a custom type touchgfx::TextButtonStyle<touchgfx::BoxClickButton>&
In interraction: create an interraction when changeBorderSize is called, with action execute C++ code : value.setBorderSize(5);
In interraction: create an button click interraction for the flexButtonName and call the changeBorderSize function with flexButtonName as argument
thanks
2021-04-06 08:38 AM
Maybe little swap
void Screen1ViewBase::flexButtonCallbackHandler(const touchgfx::AbstractButtonContainer& src)
{
if (&src == &flexButtonName)
{
//InteractionName
changeBorderSize(&src); // in base hpp as virtual
}
}
// Screen1View.cpp
Screen1View::changeBorderSize(const touchgfx::TextButtonStyle<touchgfx::BoxClickButton>& src)
{
src.setBorderSize(5); // I got build error: "incomplete type 'Screen1View' used in nested name specifier"
}
2021-04-07 01:23 AM
Hi @MM..1 , thanks for your answer.
Screen1ViewBase.hpp is generated only so I had to call a new virtual function changeBorderSize on InterractionName in touchGFX. But I can't pass any argument (&src) in it. Should I make a custom container with a custom trigger instead ?
Even if I implement changeBorderSize in Screen1View I got the following error :
error: passing 'const touchgfx::TextButtonStyle<touchgfx::BoxWithBorderButtonStyle<touchgfx::ClickButtonTrigger> >' as 'this' argument discards qualifiers [-fpermissive]
48 | src.setBorderSize(5);
thanks
2021-04-07 02:21 AM
I solved my problem. 3 steps in touchGFX:
In Screen1: create an action changeBorderSize with a custom type touchgfx::TextButtonStyle<touchgfx::BoxClickButton>&
In interraction: create an interraction when changeBorderSize is called, with action execute C++ code : value.setBorderSize(5);
In interraction: create an button click interraction for the flexButtonName and call the changeBorderSize function with flexButtonName as argument
thanks