1: no, the reason for last added button is that touchGFX designer creates screenviewbase file with the :
void ScreenViewBase::buttonCallbackHandler(const touchgfx::AbstractButton& src)
{
if (&src == &BUTTON1)
{
//button 1 code
}
else if (&src == &BUTTON2)
{
//button2 code
}
//ecc
}
so if u add a dummy button 3 (hidden, not visible ecc) and add the code i wrote in previous code u will have:
void ScreenViewBase::buttonCallbackHandler(const touchgfx::AbstractButton& src)
{
if (&src == &BUTTON1)
{
//button 1 code
}
else if (&src == &BUTTON2)
{
//button2 code
}
else if (&src == &BUTTON3)
{
}
#ifdef SIMULATOR
Beep(BUZZER_NOTE_MEDIUM, BUZZER_NOTE_DURATION);
#endif // SIMULATOR
presenter->touchFeedBack(); //function which make my buzzer beep
{
}
as u see the starting { close the button 3 condition, so the following code will be executed after any button is clicked
2: yes is invisible and i serve only the purpose to "inject that code, u can alsomuse the last button you create, but remember if later you add another button, you have to modify that interaction to always use the last button, ot the closing } trick won't work, try yourself and you will figure it out.
3 yes, i comunicate with my hardware through presenter, then model, so yes that trick must be used on every screen, but is better that do for every button