2022-09-18 11:34 PM
I use stm32f767 and implement one button in screen
the reaction of the button such as change screen color or run functions not works
why?
2022-09-23 07:42 AM
excuse me I can't understand your question.
I use many interaction like change screen or change box color or....
al of the not works at all.
but the button picture changes
but it does not run any code in interaction...
2022-09-23 11:47 AM
Ok i download your code and get reply ... you create box1 and set change colour ... generator generate this in base
Screen1ViewBase::Screen1ViewBase() :
buttonCallback(this, &Screen1ViewBase::buttonCallbackHandler)
{
__background.setPosition(0, 0, 800, 480);
__background.setColor(touchgfx::Color::getColorFromRGB(0, 0, 0));
box1.setPosition(0, 0, 800, 480);
box1.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
button1_1.setXY(292, 204);
button1_1.setBitmaps(touchgfx::Bitmap(BITMAP_BLUE_BUTTONS_ROUND_EDGE_SMALL_ID), touchgfx::Bitmap(BITMAP_BLUE_BUTTONS_ROUND_EDGE_SMALL_PRESSED_ID));
button1_1.setAction(buttonCallback);
add(__background);
add(box1);
add(button1_1);
}
void Screen1ViewBase::setupScreen()
{
}
void Screen1ViewBase::buttonCallbackHandler(const touchgfx::AbstractButton& src)
{
if (&src == &button1_1)
{
//Interaction1
//When button1_1 clicked change color of box1
//Set RGB color R:0, G:0, B:0 on box1
box1.setColor(touchgfx::Color::getColorFromRGB(0,0,0));
box1.invalidate();
}
}
All is ok , but for this work need setup canvas buffer size or try little box2 10x10 pixel and will see. Plus place breakpoint in callback if it work