cancel
Showing results for 
Search instead for 
Did you mean: 

interaction in button in touchgfx not work

jhasa.2
Associate III

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?

21 REPLIES 21

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...

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