2022-11-22 05:22 AM
Hi everyone
I am new to toughgfx and need a scroll wheel for our new project. So I started with the tutorial 4. I think I followed every step, but when I copy the code, I get an error. The problem seems to be the textBuffer and TEXT_SIZE (Unicode::itoa(no, textBuffer, TEXT_SIZE, 10);). I get the message that they are not defined.
As far as I know the tutorial should have all the steps and all the code needed.
Any Idea what I'm missing?
Thank you!
#ifndef MENUELEMENT_HPP
#define MENUELEMENT_HPP
#include <gui_generated/containers/MenuElementBase.hpp>
#include <BitmapDatabase.hpp>
class MenuElement : public MenuElementBase
{
public:
MenuElement();
virtual ~MenuElement() {}
virtual void initialize();
void setNumber(int no)
{
Unicode::itoa(no, textBuffer, TEXT_SIZE, 10);
switch (no % 7)
{
case 0:
icon.setBitmap(Bitmap(BITMAP_ICON00_ID));
break;
case 1:
icon.setBitmap(Bitmap(BITMAP_ICON01_ID));
break;
case 2:
icon.setBitmap(Bitmap(BITMAP_ICON02_ID));
break;
case 3:
icon.setBitmap(Bitmap(BITMAP_ICON03_ID));
break;
case 4:
icon.setBitmap(Bitmap(BITMAP_ICON04_ID));
break;
case 5:
icon.setBitmap(Bitmap(BITMAP_ICON05_ID));
break;
case 6:
icon.setBitmap(Bitmap(BITMAP_ICON06_ID));
break;
}
}
protected:
};
#endif // MENUELEMENT_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 scrollWheelUpdateItem(MenuElement& item, int16_t itemIndex)
{
item.setNumber(itemIndex);
}
protected:
};
#endif // SCREEN1VIEW_HPP
Solved! Go to Solution.
2022-11-24 07:35 AM
Hello FMuel.3,
It won't work because you didn't checked the checkbox "use wildcard buffer" on your text Area. Like this :
It's not explicitly said in the tutorial 4. Thanks for reporting this. We will do the modification for the next version of the documentation because it might be confusing indeed.
/Osman
2022-11-24 07:35 AM
Hello FMuel.3,
It won't work because you didn't checked the checkbox "use wildcard buffer" on your text Area. Like this :
It's not explicitly said in the tutorial 4. Thanks for reporting this. We will do the modification for the next version of the documentation because it might be confusing indeed.
/Osman
2022-11-24 10:03 PM
Thank you very much!
It also helped me with another problem that I had. I just missed to select "Use wildcard buffer". Now it works, thank you.