cancel
Showing results for 
Search instead for 
Did you mean: 

counter will not increment beyond 9 and does not show negative numbers. Designer 4.26.0

ksale.1
Senior

I was following the tutorial in the link:  

https://www.youtube.com/watch?v=vy1c1LbypuM&list=PLfIJKC1ud8giOsk-C4BCOwSHtbXqTNb1W&index=3 

I couldn't gett the upclick to count greater than 9 and below 0. the screenView.hpp and cpp as follows:                       

hpp:

#ifndef SCREEN1VIEW_HPP
#define SCREEN1VIEW_HPP

#include <gui_generated/screen1_screen/Screen1ViewBase.hpp>
#include <gui/screen1_screen/Screen1Presenter.hpp>

class Screen1View : public Screen1ViewBase
{
public:
    Screen1View();
    virtual ~Screen1View() {}
    virtual void setupScreen();
    virtual void tearDownScreen();

    virtual void downclicked();
    virtual void upclicked();

    

protected:

    uint16_t counter = 0;
};

#endif // SCREEN1VIEW_HPP


cpp:


#include <gui/screen1_screen/Screen1View.hpp>

Screen1View::Screen1View()
{

}

void Screen1View::setupScreen()
{
    Screen1ViewBase::setupScreen();
}

void Screen1View::tearDownScreen()
{
    Screen1ViewBase::tearDownScreen();
}

void downclicked(){
	counter--;
	Unicode::snprintf(textArea1Buffer, TEXTAREA1_SIZE, "%u", counter);
	textArea1.invalidate();
}

void upclicked(){
	counter++;
	Unicode::snprintf(textArea1Buffer, TEXTAREA1_SIZE, "%u", counter);
	textArea1.invalidate();
}
Thank you in advance for your help
0 REPLIES 0